Skip Montanaro <[EMAIL PROTECTED]> writes:

>     Tim> hi,
>     Tim> i'd like to use pygtk widget classes as base classes to my own, like
> 
>     Tim> class myVBox (GtkVBox):
>     Tim>   ...
> 
>     Tim> now if i understand correctly, the python wrapping code in gtk.py
>     Tim> is planned to be rewritten in c. will this break code like above?
> 
> I believe it should work.  The new version uses Digital Creations'
> ExtensionClass to allow objects to be subclassed in Python.

However, IIRC, calling a baseclass' method in a method has to be done
slightly different. E.g.

        class MyBox(GtkBaseClass):

                def __init__(self):
                        GtkBaseClass.__init__(self)


will fail because type(self) isn't InstanceType. James pointed out some
other pifalls in
http://www.daa.com.au/pipermail/pygtk/2000-June/000104.html

AFAIK, the reason to use ExtensionClasses in the first place was to make
sure that there is exactly one pygtk object for every GTK widget.
Without ExtensionClasses you get circular references. In Python 2.1
there'll be weak references which would provide a solution for this
problem. Wouldn't it make more sense to rely on that?

  Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                               http://mapit.de/
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to