How to use a color value returned by colorChooser?

MRAB python at mrabarnett.plus.com
Wed Dec 14 23:10:55 EST 2011


On 15/12/2011 02:26, Muddy Coder wrote:
> Hi Folks,
>
> This should be a simple question, but I just can't get an answer from
> Phython Docs. You see, when we created a widget, and need to tweak the
> color, we just simply configure it, such as:
>
> abutton = Button(root, text='Foo')
> abutton.config(fg='blue')
>
> so we can make the Button color in blue. However, when I choose a
> color by a color Dialog, askcolor, and then I will get a color value
> as:   (0, 0, 255) ..... So, I want to use this returned color value to
> configure my existing widgets, with widget.config() syntax. The Python
> interpreter does not take it. Therefore, I think I must need to covert
> this returned color value into a symbolic name, such as 'blue', 'red'
> and so on, then the widget.config() syntax can be used. How can I
> convert this color value? Please help, thanks folks!
>
Look here:

http://effbot.org/tkinterbook/tkinter-widget-styling.htm



More information about the Python-list mailing list