[Tkinter-discuss] what is the meanning of triple?

Cameron Laird Cameron at phaseit.net
Sun Aug 21 21:22:52 CEST 2011

On Sun, Aug 21, 2011 at 01:57:21PM +0800, 守株待兔 wrote:
> here is the code:
> from Tkinter import * 
> from tkColorChooser import askcolor 
> def setBgColor(): 
>     (triple, hexstr) = askcolor() 
>     if hexstr: 
>         print hexstr
>         push.config(bg=hexstr) 
> root = Tk() 
> push = Button(root, text='Set Background Color', command=setBgColor) 
> push.config(height=3, font=('times', 20, 'bold')) 
> push.pack(expand=YES, fill=BOTH) 
> root.mainloop()
>  in  the  (triple, hexstr) = askcolor(), i want to know the meaning of triple??
Your question surprises me a bit; it makes me think
that you would benefit from more practice with Python
basics, and that you're "working too hard".

At one level, the answer is, "'triple' is a color
triple, that is, a 3-tuple of integers from the range

Here's another way to approach the answer:  launch an
interactive shell, that is, type "python" at the shell
prompt in Linux, MacOS, ..., or click on ActiveState
Python for Windows, or ...  This is an important step.
Your progress in Python (let alone Tkinter) will be
much, MUCH faster once you have comfort and familiarity
with the interactive shell.

At Python's prompt, enter two lines:
  >>> import tkColorChooser
  >>> tkColorChooser.askcolor()
Soon a new window, one with a "color wheel", will pop
up.  Click on a color.  Select "OK".  Back at the Python
prompt, you'll see something like

  ((90, 255, 140), '#5aff8c')

The "(90, 255, 140)" part is triple.

I don't know what you intend by "the meaning of triple",
but what I've written above surely gets you closer to it.
I strongly urge you, again, to practice Python basics.

More information about the Tkinter-discuss mailing list