Terry J. Reedy <tjre...@udel.edu> added the comment:

For future reference, 3.4 and 3.5 only get security fixes.

The quoted line of code is from the main part of 
tkinter.colorchooser,Chooser._fixresult:
        r, g, b = widget.winfo_rgb(result)
        return (r/256, g/256, b/256), str(result)

where tkinter.Misc defines
    def winfo_rgb(self, color):
        """Return tuple of decimal values for red, green, blue for
        COLOR in this widget."""
        return self._getints(
            self.tk.call('winfo', 'rgb', self._w, color))

The code in tkColorChooser and Tkinter in 2.x is the same.

The docstring for winfo_rgb is wrong as it returns a tuple of ints in 
range(2**16256).  For red, the results are
>>> Tk().winfo_rgb('red')
(65535, 0, 0)  # 2.x and 3.x
>>> cc.askcolor('red')
((255, 0, 0), '#ff0000')  # 2.7
>>> cc.askcolor('red')
((255.99609375, 0.0, 0.0), '#ff0000')  # 3.8

In addition to fixing the winfo_rgb docstring (in all versions), and adding doc 
strings to colorchooser, it seems that '/' should be '//' in 3.x.  I don't know 
if I would fix this in 3.6.

----------
nosy: +serhiy.storchaka, terry.reedy
title: askcolor is returning floats for r,g,b values instead of ints -> tkinter 
askcolor returning floats for r,g,b values instead of ints
type:  -> behavior
versions:  -Python 3.4, Python 3.5

_______________________________________
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