This routine is the main event loop, call it to set your application
rolling. Mask is the mask of events you want to handle,
wait is the number of ticks you want to leave to other
concurrent application (default 0, which is probably not a good
idea). While raising self to exit the mainloop is still
supported it is not recommended: call self._quit() instead.
The event loop is split into many small parts, each of which can be
overridden. The default methods take care of dispatching events to
windows and dialogs, handling drags and resizes, Apple Events, events
for non-FrameWork windows, etc.
In general, all event handlers should return 1 if the event is fully
handled and 0 otherwise (because the front window was not a FrameWork
window, for instance). This is needed so that update events and such
can be passed on to other windows like the Sioux console window.
Calling MacOS.HandleEvent() is not allowed within
our_dispatch or its callees, since this may result in an
infinite loop if the code is called through the Python inner-loop
Call this method with a nonzero parameter to enable
asynchronous event handling. This will tell the inner interpreter loop
to call the application event handler async_dispatch whenever events
are available. This will cause FrameWork window updates and the user
interface to remain working during long computations, but will slow the
interpreter down and may cause surprising results in non-reentrant code
(such as FrameWork itself). By default async_dispatch will immedeately
call our_dispatch but you may override this to handle only certain
events asynchronously. Events you do not handle will be passed to Sioux
The user typed character c. The complete details of the event
can be found in the event structure. This method can also be
provided in a Window object, which overrides the
application-wide handler if the window is frontmost.
Called early in the event loop to handle modeless dialog events. The
default method simply dispatches the event to the relevant dialog (not
through the the DialogWindow object involved). Override if you
need special handling of dialog events (keyboard shortcuts, etc).