[pygtk] Re: Cannot subclass gtk.Widget
Jeffrey Barish
jeff_barish at earthlink.net
Fri Mar 9 07:57:54 WST 2007
Johan Dahlin wrote:
> You need to call gobject.type_register(YourGtkWidgetSubclass) or set the
> class variable __gtype_name__ among other things.
>
> For a complete example, look at the widget.py:
>
>
http://svn.gnome.org/viewcvs/pygtk/trunk/examples/gtk/widget.py?view=markup
>
> Hope this helps.
Yes, it does. Your citation was what I was looking at, but I didn't
understand that I needed to replicate so much. Wow, it's really
complicated subclassing in GTK.
I still don't understand what to do if my widget is composed of other
widgets (rather than Cairo drawing and text). A simplification of what I
am trying to do is to create a widget with two buttons. I guess that I
need to do something different in do_expose_event and do_size_request, but
I'm not sure what. To begin with, it isn't clear to me what the do_
methods are. Do they override event handlers in the abstract Widget class?
I don't see documentation for them there. I tried calling do_realize and
do_expose_event on the button, but those calls fail (although the methods
apparently exist).
--
Jeffrey Barish
More information about the pygtk
mailing list