[pygtk] PyGtk_FatalExceptions replacement?
Andrew Reid
Andrew.Reid at nist.gov
Tue Jan 31 05:30:34 WST 2006
Hi all --
We're in the process of cleaning up the port of our application
from pygtk-0.6.9 to pygtk-2.6.1. Most things transferred over
in a reasonably straightforward way, but there's an issue we put
off, and I'm not sure how to handle it.
We have some mouse callbacks from a GtkCanvas, which are handled
in C++ code, which then calls out to Python to run a handler.
In the pygtk-0.6.9 version, there's an fatal-error check in the C++
handler, like this: (The example is actually from the config callback,
but the mouse-event ones are similar)
> void CanvasObj::configure_event_callback( ... ) {
> PyGILState_STATE state = (PyGILState_STATE) pyg_gil_state_ensure();
> try {
> PyObject *args = Py_BuildValue("iiii",
> (int)(a->x), (int)(a->y),
> (int)(a->width), (int)(a->height));
> if (args) {
> // Call the Python handler for the configuration event...
> PyObject *result = PyObject_CallObject(config_callback, args);
> if (result==NULL) {
> if (PyGtk_FatalExceptions) { // <--- ERROR CHECK IS HERE
> gtk_main_quit();
> ... etc ...
I've been poking around to see if there is a pygtk2 equivalent of
this, but there doesn't seem to be. If this functionality is available,
it seems prudent to use it. Are these errors detectable by some
other means now?
-- A.
--
Dr. Andrew C. E. Reid, Guest Researcher
Center for Theoretical and Computational Materials Science
National Institute of Standards and Technology, Mail Stop 8500
Gaithersburg MD 20899 USA
andrew.reid at nist.gov
More information about the pygtk
mailing list