Message 315619 - Python tracker

Message315619

Author cheryl.sabella
Recipients Bryan.Oakley, cheryl.sabella, serhiy.storchaka, terry.reedy
Date 2018-04-22.15:43:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1524411783.69.0.682650639539.issue33289@psf.upfronthosting.co.za>
In-reply-to
Content
Adding to what Serhiy said about the askcolor() return value is an issue that also affects input:


>>> cc.askcolor('red')
((255, 0, 0), '#ff0000')
>>> cc.askcolor((255, 0, 0))
((255, 0, 0), '#ff0000')
>>> cc.askcolor((65535, 0, 0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cheryl/cpython/Lib/tkinter/colorchooser.py", line 75, in askcolor
    return Chooser(**options).show()
  File "/home/cheryl/cpython/Lib/tkinter/commondialog.py", line 43, in show
    s = w.tk.call(self.command, *w._options(self.options))
_tkinter.TclError: invalid color name "#ffff0000"


Changing _fixoptions to format initialcolor using "#%04x%04x%04x" % color.

allows for 16-bit hex values, but it's not the same as 8-bit.

>>> cc.askcolor('red')
((255, 0, 0), '#ff0000')
>>> cc.askcolor((255, 0, 0))
((0, 0, 0), '#000000')
>>> cc.askcolor((65535, 0, 0))
((255, 0, 0), '#ff0000')

(255, 0, 0) in the second call is black and not red.
History
Date User Action Args
2018-04-22 15:43:03cheryl.sabellasetrecipients: + cheryl.sabella, terry.reedy, serhiy.storchaka, Bryan.Oakley
2018-04-22 15:43:03cheryl.sabellasetmessageid: <1524411783.69.0.682650639539.issue33289@psf.upfronthosting.co.za>
2018-04-22 15:43:03cheryl.sabellalinkissue33289 messages
2018-04-22 15:43:03cheryl.sabellacreate