[pygtk] [gtk.colorbutton] How to get the color in hexadecimal string

John Finlay finlay at moeraki.com
Tue Oct 18 00:41:56 WST 2005


philopensource at hotmail.com wrote:

> Hi list,
>
> I'm using a gtk.colorbutton to select a color.
> My problem is to retrieve the hexadecimal string from the 
> |gtk.gdk.Color. 
> <http://www.pygtk.org/pygtk2reference/class-gdkcolor.html#constructor-gdkcolor> 
>
>
> I tryied also to retrieve the rgb value but without success.
> Eveytime i try, it return me 0 as value.
>
> Can i retrieve it directly in the | gtk.colorselectiondialog, as we 
> can see the hexadecimal string?

Try something like:

colorstring = 
gtk.color_selection_palette_to_string([colorbutton.get_color()])

John


More information about the pygtk mailing list