How to use a color value returned by colorChooser?

M

Muddy Coder

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!

Cosmo
 
M

MRAB

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top