2.9.1 Application Objects
Application objects have the following methods, among others:
Override this method if you need menus in your application. Append the
menus to the attribute menubar.
Override this method to return a text string describing your
application. Alternatively, override the do_about() method
for more elaborate ``about'' messages.
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
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
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 old on/off value is returned.
Terminate the running mainloop() call at the next convenient
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
DialogWindow object involved). Override if you
need special handling of dialog events (keyboard shortcuts, etc).
Called by the main event loop when no events are available. The
null-event is passed (so you can look at mouse position, etc).
Vedete Circa questo documento... per informazioni su modifiche e suggerimenti.