[pygtk] Subclassing GObject and virtual functions

Samuel Cormier-Iijima sciyoshi at gmail.com
Fri Aug 11 00:48:25 WST 2006

Hey everybody,

First of all, I'm new to the list, and thanks for the great python bindings :-)

I've been trying to learn some stuff about GObjects and PyGTK and I
was wondering how PyGObject handles virtual functions. h2defs.py
doesn't read the vfunc table from the header, so you have to manually
edit the defs file. I have something like this in the .defs:

(define-vfunc on_connected
  (of-object "TorqueSocket")
  (return-type "none")

This is how the gtkmm bindings create virtual functions. However, this
isn't working very well. I was wondering if there was any
documentation about how this works? If I subclass my object in Python,
can calling the virtual function from the C call the Python function?
I read something about marshallers, but I don't quite understand them.
I've also read [1] but its a little old and doesn't talk about vfuncs
in particular. Any tips or pointers would be appreciated :-)


[1] http://www.sicem.biz/personal/lgs/docs/gobject-python/gobject-tutorial.html

More information about the pygtk mailing list