[pygtk] GTK_IS_WIDGET on subclass of a widget fails
Jeffrey Finkelstein
jeffrey.finkelstein at gmail.com
Thu May 21 21:33:06 WST 2009
I'm new to Gtk. I tried to create a subclass of an HBox and add it to a
window, but I get a GtkWarning telling me that the assertion
`GTK_IS_WIDGET()' fails on the instance of my subclass.
For example:
===code===
from gtk import Window, HBox, WINDOW_TOPLEVEL, main
class FooBox(HBox):
def __init__(self): pass
window = Window(WINDOW_TOPLEVEL)
window.add(FooBox())
window.show_all()
main()
===/code===
yields a warning at "window.add()", namely "GtkWarning:
gtk_container_add: assertion `GTK_IS_WIDGET (widget)' failed". This
causes the widget to not be displayed in the window.
I don't really understand why this is; am I missing a method call?
Thanks.
Jeffrey
More information about the pygtk
mailing list