On Thu, Jun 19, 2003 at 08:02:16PM -0500, Art Haas wrote:
> On Thu, Jun 19, 2003 at 05:50:45PM -0700, John Finlay wrote:
> >
> > Hi Art,
> >
> > I don't think you should get the same gtk.gdk.Color object returned from:
> >
> > da.get_style().bg[gtk.STATE_NORMAL]
> >
> > even twice in a row. A new gtk.gdk.Color object is created each time. I
> > assume that the rgb values are the same though.
> >
>
> That does not seem to be the case ...
>
> $ python
> >>> import gtk
> >>> da = gtk.DrawingArea()
> >>> color = gtk.gdk.color_parse('#ffffff')
> >>> color.red
> 65535
> >>> color.green
> 65535
> >>> color.blue
> 65535
> >>> da.modify_bg(gtk.STATE_NORMAL, color)
> >>> stcol = da.get_style().bg[gtk.STATE_NORMAL]
> >>> stcol.red
> 56540
> >>> stcol.green
> 56026
> >>> stcol.blue
> 54741
> >>> gtk.pygtk_version
> (1, 99, 16)
> >>>
Well, even though what I tried above indicates that using get_style()
shouldn't work, running the code in my test program works. I'm guessing
that there is more GTK magic going on when widgets are being drawn than
in my test code above. The end result is I've stumbled into a working
solution using get_style().
Art
--
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.
-Thomas Jefferson to James Smith, 1822
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/