Pmw.MenuBar

Name

Pmw.MenuBar() - manager widget for menu buttons and menus

Inherits

Pmw.MegaWidget

Description

This class creates a manager widget for containing menus. There are methods to add menu buttons and menus to the menu bar and for adding menu items to the menus. Menu buttons may be added to the left or right of the widget. Each menu button and menu item may have help text to be displayed by a Pmw.Balloon widget.

Options

Options for this megawidget and its base classes are described below.

balloon
Specifies a Pmw.Balloon widget to display the help text for menu buttons and menu items. If None, no help is displayed. The default is None.

padx
Initialisation option. Specifies a padding distance to leave between each menu button in the x direction and also between the menu buttons and the outer edge of the menu bar. The default is 0.

Components

Components created by this megawidget and its base classes are described below.

hull
This acts as the body for the entire megawidget. Other components are created as children of the hull to further specialise the widget. By default, this component is a Tkinter.Frame.

Dynamic components

Menu buttons and menu components are created dynamically by the addmenu() method. By default, the buttons are of type Tkinter.Menubutton and are created with a component group of Button. Menus are of type Tkinter.Menu and are created with a component group of Menu.

Methods

Only methods specific to this megawidget are described below. For a description of its inherited methods, see the manuals for its base classes.

addcascademenu(menuName, submenu, help = '', **kw)

addmenu(menuName, balloonHelp, statusHelp = None, side = 'left', **kw)
Add a menu button and its associated menu to the menu bar. Any keyword arguments present will be passed to the constructor when creating the menu button. If the text keyword argument is not given, the text option of the menu button defaults to menuName. Each menu button is packed into the menu bar using the given side, which should be either left or right.

If the balloon option has been defined, balloonHelp and statusHelp are passed to the balloon as the help strings for the menu button. See the bind() method of Pmw.Balloon for how these strings may be displayed.

The menu button is created as a component named menuName-button and the menu is created as a component named menuName-menu. The method returns the menu button component widget.

addmenuitem(menuName, type, help = '', **kw)
Add a menu item to the menu given by menuName. The kind of menu item is given by type and may be one of command, separator, checkbutton, radiobutton or cascade. Any keyword arguments present will be passed to the menu when creating the menu item. See Tkinter.Menu for the valid options for each type. When the mouse is moved over the menu item, the string given by help will be displayed by the balloon's statuscommand.

deletemenu(menuName)

deletemenuitems(menuName, start = '0', end = None)

disableall()

enableall()

Home. Pmw 0.6.2 Maintainer gregm@iname.com. 23 Feb 1998