[pygtk] Re: [Python-Dev] a bit confused about the new type/class stuff

James Henstridge james@daa.com.au
Thu, 4 Oct 2001 20:26:45 +0800 (WST)


On Thu, 4 Oct 2001, Guido van Rossum wrote:

> > Thanks for the various tips.  I will check 'em out.  Regarding the Don
> > Beaudry hook, PyGtk was using ExtensionClass until recently.  James
> > Henstridge has just released the first cut at using your new type/class
> > stuff in the past few days.  So if you didn't use it, neither does PyGtk.
>
> Ah, but then it could be that somehow this cutting-edge PyGtk has
> caused your immediate problem, right?  I still take responsibility --
> the new type stuff isn't documented enough yet. :-(

I think I got everything right as far as the new type code goes (and it
works in most cases.  For reference, the gtk.Button instance is a new
style type (subclassed from other new style types implemented in C, single
inheritance).  The base class (GObject) implements the tp_compare slot in
the type object, and doesn't implement rich comparisons:

  >>> import gtk
  >>> gtk.Button.__cmp__
  <slot wrapper '__cmp__' of 'GObject' objects>
  >>> b = gtk.Button()
  >>> b.__cmp__
  <method-wrapper object at 0x8268df8>

I don't think I am doing anything weird in the tp_compare slot (although
the function would only handle GObject instances).

>
> > This is too new to have tarballs yet (lots of hairballs perhaps...).
> > Everything is coming out of various CVS repositories.  If you want to waste
> > a half a day getting all the Gtk build tools and libraries correct, I can
> > set you up, but I suspect you may have better things to do with your time.
>
> Yup.

Well, the 1.3.9 releases of glib and gtk are usable.  The last development
release of pygtk (1.99.2) had some issues, as it was released just after I
merged the branch where I ported things to 2.2.  I will put out a 1.99.3
release soon which should work a bit better.

James.

-- 
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/