[pygtk] Extract GtkObject from PyObject

Stefan Stuhr gnomelists at sstuhr.dk
Sat May 23 23:40:35 WST 2009


fre, 22 05 2009 kl. 14:32 -0700, skrev Jeremy Lewi:
> Hi,
> 	I'm trying to embed python in my c-application so that I can use
> matplotlib. My python code sets up a GtkObject to sends signals.  I want
> to pass a reference to this GtkObject back to my C-Code so that I can
> then send signals from C. I can use SWIG to create C functions that are
> callable from python. In this case I pass a Python GtkObject
> (PyGtkObject) into my C-function. From this PyObject I need to extract a
> GtkObject so that I can use it with the gtk functions in C. 
> 	Can anyone help me do this? I assume PyGtk does this in order to
> interface with the C language bindings for gtk.

I don't know whether it will help, but I have used the Python built-in
function hash(object) in the past to pass PyGTK gobjects to ctypes
loaded libraries.

> Thanks
> Jeremy

Stefan



More information about the pygtk mailing list