Cheryl Sabella <chek...@gmail.com> added the comment:

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.

----------
nosy: +csabella

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33289>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to