Message315548
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. |
|
Date |
User |
Action |
Args |
2018-04-21 03:24:52 | terry.reedy | set | recipients:
+ terry.reedy, serhiy.storchaka, Bryan.Oakley |
2018-04-21 03:24:52 | terry.reedy | set | messageid: <1524281092.48.0.682650639539.issue33289@psf.upfronthosting.co.za> |
2018-04-21 03:24:52 | terry.reedy | link | issue33289 messages |
2018-04-21 03:24:50 | terry.reedy | create | |
|