[pygtk] custom widgets and libglade (FAQ 22.7)

Christian Becke christianbecke at web.de
Thu Apr 20 22:24:48 WST 2006


Hi all,

I just started working with python and pygtk and tried to use a custom
widget with libglade.
Reading the docs and FAQ, I finally was able to get my custom widget
into the UI - well, sort of. I could access it's signals, but it never
showed up in the UI, although "Visible" was set to "Yes" in glade.
After some research I found out that this is due to a bug in libglade
[1]: common properties (e.g. 'visible') are not set by libglade for
custom widgets.
So you have to set these properties in your widget creation function,
e.g.:

gtk.glade.set_custom_handler (myhandler)
glade = gtk.glade.XML ("ui.glade")

def myhandler (glade, function_name, widget_name, str1, str2, int1,
int2):
	custom_widget = MyCustomWidget ()
	custom_widget.show ()
	return custom_widget

Maybe this should be added to FAQ 22.7 "How do I create and use a custom
Glade widget?"


Regards,

Christian Becke

[1] http://bugzilla.gnome.org/show_bug.cgi?id=97503



More information about the pygtk mailing list