[Pythonmac-SIG] Python and Events
Jack Jansen
jack@oratrix.nl
Thu, 16 Nov 2000 12:27:41 +0100
The Python mainloop does handle the events while it is busy, but they
probably never get back to your GUI code. If you look at
PyMac_HandleEvent and PyMac_HandleEventIntern you'll see that it tries
to handle events through a Python handler, if that doesn't work it
handles mousedowns in other applications, and if that didn't handle
the event it passes it to SIOUXHandleOneEvent.
One way to get the events to your GUI-code is to create a Python
method that passes the event to your GUI code, and call
MacOS.SetEventHandler() with that method as parameter.
Another option is to add a C API that allows other C code to register
event handlers with PyMac_HandleEvent. The handlers should probably
have the signature
bool (*handleevent)(EventRecord *);
and return true if the event is completely
handled. PyMac_HandleEventIntern could call this handler first, and
only continue its other processing if it returns false.
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm