[Tkinter-discuss] what is the meanning of triple?
Michael Lange
klappnase at web.de
Sun Aug 21 10:59:37 CEST 2011
Hi,
oops, I accidentally hit the "Send" button :(
> Thus spoketh "守株待兔" <1248283536 at qq.com>
> unto us on Sun, 21 Aug 2011 13:57:21 +0800:
>
> > (triple, hexstr) = askcolor()
As you have probably noticed the return value of askcolor() is something
like:
>>> askcolor()
((214, 215, 214), '#d6d7d6')
where the second part is the original color string as returned by
tk_chooseColor , the first part, the 3-tuple, was apparently brought to us
by Frederik Lundh, who wrote the tkColorChooser module. The magic lines
from tkColorChooser.py are:
# to simplify application code, the color chooser returns
# an RGB tuple together with the Tk color string
r, g, b = widget.winfo_rgb(result)
return (r/256, g/256, b/256), str(result)
so you see, the triple is simply a tuple of (red, green, blue) color
values, ranging from 0 - 255 .
I hope this helps
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
Only a fool fights in a burning house.
-- Kank the Klingon, "Day of the Dove", stardate unknown
More information about the Tkinter-discuss
mailing list