Samuel Cormier-Iijima wrote:
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")
)

PyGTK defines virtuals like:

(define-virtual start_editing
 (of-object "GtkCellEditable")
 (return-type "none")
 (parameters
   '("GdkEvent*" "event")
 )
)

I added a new program in pygtk cvs head to replace h2def.py. It generates the virtual definitions. It's called defsgen.py. It depends on the Python ctypes modules to extract object info from installed shared libraries. Alternatively Gustavo wrote a program scanvirtuals.py to generate virtual defs.
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 :-)

There are some examples of using virtuals in the PyGTK examples directory.

John
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to