Disponibilità: Macintosh.
The FrameWork module contains classes that together provide a framework for an interactive Macintosh application. The programmer builds an application by creating subclasses that override various methods of the bases classes, thereby implementing the functionality wanted. Overriding functionality can often be done on various different levels, i.e. to handle clicks in a single dialog window in a non-standard way it is not necessary to override the complete event handling.
The FrameWork is still very much work-in-progress, and the documentation describes only the most important functionality, and not in the most logical manner at that. Examine the source or the examples for more details. The following are some comments posted on the MacPython newsgroup about the strengths and limitations of FrameWork:
The strong point of FrameWork is that it allows you to break into the control-flow at many different places. W, for instance, uses a different way to enable/disable menus and that plugs right in leaving the rest intact. The weak points of FrameWork are that it has no abstract command interface (but that shouldn't be difficult), that it's dialog support is minimal and that it's control/toolbar support is non-existent.
The FrameWork module defines the following functions:
) |
) |
bar, title[, after]) |
MenuBar
the menu appears in, the title string and a
position (1-based) after where the menu should appear (default:
at the end).
menu, title[, shortcut, callback]) |
Instead of a callable object the callback can also be a string. In
this case menu selection causes the lookup of a method in the topmost
window and the application. The method name is the callback string
with 'domenu_'
prepended.
Calling the MenuBar
fixmenudimstate() method sets the
correct dimming for all menu items based on the current front window.
menu) |
menu, label) |
parent) |
parent) |
width, height) |
(left, top, right, bottom)
tuple suitable for creation of a window of given width and height. The
window will be staggered with respect to previous windows, and an
attempt is made to keep the whole window on-screen. However, the window will
however always be the exact size given, so parts may be offscreen.
) |
) |