James Cassidy wrote: > Hi, I'm new to this list, and I'd first just like to say I > appreciate all the work the authors have done on the PyGTK bindings, > which I use on a regular bases for rapid development. > > I just have one question: > > I've reached the point where I'd like to be able pass PyGTK's object > to and from C code I've written. Is there a standard way to get the > GtkObject of PyGTK's objects so that I can use the standard GTK > calls in C on it? > > Will the method change for the new bindings that are being > written in straight C? > For the stable bindings (0.6.x), you should include the <pygtk.h> header file in your python extension, and call init_pygtk() during module initialisation. Then you can check if a PyObject is a GtkObject wrapper with PyGtk_Check(o), or use the "O!" typecode to PyArg_ParseTuple(), using &PyGtk_Type as the type object. You will need to pass the "widget._o" to your C extension rather than just "widget" as there is two levels of wrapping in the stable bindings (a straight procedural binding in the _gtk module, then a OO binding built on top).
For the development bindings (1.99.x), things are a bit easier because there is only one layer of wrapping. Just include <pygobject.h>, and call init_pygobject() during module initialisation. You can use pygobject_get() to retrieve the C level GObject. No _o's are used. James. -- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/ _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/