[pygtk] Cannot subclass gtk.Widget

Johan Dahlin jdahlin at async.com.br
Fri Mar 9 06:20:46 WST 2007


Jeffrey Barish wrote:
> I am trying to create a custom widget.  Following examples I found from a
> Google search, I am trying to subclass gtk.Widget.  I get the error
> message:
> 
> TypeError: cannot create instance of abstract (non-instantiable) type
> `GtkWidget'

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.

-- 
Johan Dahlin <jdahlin at async.com.br>
Async Open Source


More information about the pygtk mailing list