From: Kevin A. <al...@se...> - 2001-10-18 19:19:50
|
The Menu classes are defined in menu.py. Menus for an app are defined in the resource file, but they are optional. The worldclock sample shows an app without a menubar. It may be possible to add and remove menus and menu items at runtime, but I have never tried this. The last time I worked on menu.py to add enable/disable and check/uncheck I decided it needed a rewrite was in order ;-) There is no support for hierarchical menus, graphics or multiple fonts in a menu. You can enable/disable and check/uncheck menu items. In addition, menu items can have an associated command which can then be bound to any number of other menu items or widgets. See the textIndexer and addresses samples. The simplest way to understand the use of the menus is to look at all the samples resource files and code. When a menu item is selected it generates a 'select' event. A bug in wxPython 2.3.1 prevents accelerator keys (Ctrl-C, Ctrl-X, Ctrl-V, etc.) from working, but the bug is fixed in the wxPython 2.3.2 beta. Dialogs are defined in dialog.py. They are all modal and map directly to a wxPython class, which map to an underlying OS dialog where available. The one exception is the FindDialog which I coded from scratch. AlertDialog (variation of MessageDialog) ColorDialog (wxColourDialog) DirectoryDialog (wxDirDialog) FileDialog (wxFileDialog) FindDialog FontDialog (wxFontDialog) MessageDialog (wxMessageDialog) ScrolledMessageDialog (wxScrolledMessageDialog) TextEntryDialog (wxTextEntryDialog) Some options are specified via constants, see dialog.py for a full list as well as the dialog sample which shows the various dialogs in use. The GenericDialog class which I did this last week has not been checked into cvs yet. If we decide to use it or a slight variation, then we will be able to do modal dialogs using the same widgets and layout mechanisms and event handlers as we use for backgrounds. There are no modeless dialogs and discussions I've had with Rowland about this topic concluded that there is not much point to the term 'modeless dialog' since in PythonCard there wouldn't be much difference from a regular background. More on that topic later. ka |