Does anybody know how to get the rgb values from a gtk.gdk.GC?
Attempting to access the values returns garbage, as evidenced by this
example:

Python 2.4 (#1, Mar  9 2005, 09:57:26) [C] on irix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>> pygtk.require('2.0')
>>> import gtk
>>> widget = gtk.Window()
>>> widget.show()
>>> style = widget.get_style()
>>> gc = style.fg_gc[gtk.STATE_NORMAL]
>>> gc.foreground
<GdkColor at 0x10327ce0>
>>> gc.foreground.red
4107
>>> gc.foreground.green
30416
>>> gc.foreground.blue
0
>>> colormap = widget.get_colormap()
>>> red = colormap.alloc_color(0xFFFF, 0x00, 0x00)
>>> red.red
65535
>>> red.green
0
>>> red.blue
0
>>> gc.foreground = red
>>> gc.foreground.red
4107
>>> gc.foreground.green
30416
>>> gc.foreground.blue
0

The color in the gc draws correctly to the screen.  I need the rgb values to
match gtk colors with rendering done by other code.


_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to