On Tue, May 14, 2002 at 04:10:14PM -0700, Mathew Yeates wrote:
>
> I'm going to make a wild ass guess here. Have you tried inserting
> the macros to block threads? Can't remember exactly what they are
> but I've seen tons of examples in the pygtk code.
>
> Mathew
For a wild ass guess, that was pretty good! I had to jump through a
few hoops to make the macro calls within C++, but after I did that the
python callbacks from the gtk canvas callbacks work.
I have a feeling that I'm still doing something wrong, because calling
the macros from pygtk.h was harder than it ought to be. I'm
including pygtk.h like this:
#define NO_IMPORT_PYGTK
#include <pygtk.h>
#undef NO_IMPORT_PYGTK
That works as long as I don't use any macros. If I call
PyGtk_BlockThreads, then python complains that _PyGtk_API is
undefined and won't load my module's .so file. So I declared my own
copy of _PyGtk_API, which feels like the wrong thing to do, but seems
to work. Then I initialize it by duplicating the init_pygtk macro.
(The reason that I can't just call init_pygtk directly is that it
won't compile with g++. g++ says that the line
_PyGtk_API = PyCObject_AsVoidPtr(cobject);
requires an explicit cast.)
Thanks again.
-- Steve
--
/* EMail: [EMAIL PROTECTED] ------------------ Phone: (301) 975-5423 --
-- WWW: http://math.nist.gov/~SLanger/ ------------ Fax: (301) 990-4127 --
-- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, MD 20899-8910 */
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/