I believe the 'class' part of the rc style refers to the GtkObject
name of the widget in question. Thus you have to call it a
GtkButton. Python class inheritance doesn't change the GtkObject name
of a widget.
Cheers,
Matt
On Fri, Sep 21, 2001 at 11:04:59AM -0500, Skip Montanaro wrote:
> The following simple example fails to set the background color of Button
> objects. If I change "Button" to "GtkButton" in the style string and
> instantiate a gtk.GtkButton it works.
>
> import gtk
>
> class Button(gtk.GtkButton):
> pass
>
> gtk.rc_parse_string('''
> style "buttonbg"
> {
> bg[NORMAL] = { 0.85, 0.50, 0.50 }
> }
> class "Button" style "buttonbg"
> ''')
>
> window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL)
>
> close = Button("quit")
> close.connect("clicked", gtk.mainquit)
> window.add(close)
>
> window.show_all()
>
> gtk.mainloop()
>
> I believe I encountered this in the context of the GtkDrawingArea at one
> point. Any ideas why style settings don't seem to work with subclasses of
> Gtk widgets?
>
> Thx,
>
> --
> Skip Montanaro ([EMAIL PROTECTED])
> http://www.mojam.com/
> http://www.musi-cal.com/
> _______________________________________________
> pygtk mailing list [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk