Tkinter color name to color object

colors, python, tkinter

Solution

You should try something like:

In [31]: rgb = button.winfo_rgb("orchid4")

In [32]: rgb
Out[32]: (35723, 18247, 35209)

where `button` is the name of your widget object.

Problem

I need to modify a widget's color in some way, for example, to make it darker, greener, to invert it. The widget's color is given by name, for example, `'orchid4'`. How do I get RGB values from a color name string?

Original source