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

Cameron Laird Cameron at phaseit.net
Sun Aug 21 21:30:20 CEST 2011


On Sun, Aug 21, 2011 at 07:22:52PM +0000, Cameron Laird 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
> 0-255."
> 
> 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.
			.
			.
			.
It occurs to me that you might not realize how to "reduce" programs,
so that you can write, and run,

   import tkColorChooser
   print tkColorChooser.askcolor()

as a "batch" program, for yourself.  Perhaps you also don't know to
look up <URL:
http://pythonware.com/library/tkinter/introduction/x1164-data-entry.htm#AEN1356 >
or <URL:
http://www.daniweb.com/software-development/python/threads/20774/page6 >
or ...


More information about the Tkinter-discuss mailing list