Menus

Menu buttons support the methods shown in Table A.9. They also support the methods of Table A.10 and delegate those calls to the underlying Menu widget.

Table A.9: MenuButton Widget Properties and Methods
Properties Description
indicatorOn If true, shows a small diamond to the right of the entry.
state normal, active, or disabled.
Methods
command

separator

radiobutton

checkbutton

cascade

These methods are simply delegated to the underlying menu. Please see the menu object's description in Table A.10.
menu Return the underlying menu associated with this menu button.

Each method of the Menu widget understands the following indexing syntax:

Table A.10 shows the properties of the Menu widget and the options available for each type of entry.

Table A.10: Menu Widget Properties and Methods
Menu Widget Properties Description
indicatorOn If true, shows a small diamond to the right of the entry.
selectColor The color of the indicator, if one is displayed.
tearOff If true, the 0th entry of the menu is a separator. When you click on it, the menu "tears off" and gets a separate top-level window.
Menu Entry Properties
Appearance:
foreground, background, font, image, indicatorOn,label The usual properties. Note that it is label, not text.
underline The integer index of a character to underline.
accelerator keysequence Shows a string to be displayed on the right of the label. Unlike Motif, you have to set up the key binding (typically on the top window) yourself. This option is for display only.
Action and Values:
state normal, active, or disabled.
command For buttonlike entries, the reference of a subroutine to call.
value var For radiobutton entries. Please see Table A.3.
variable var Available only for checkbutton and radiobutton entries.
onvalue val, offvalue val For checkbutton entries. Stored in the associated variable.
Methods
command (options)

separator (options)

radiobutton (options)

checkbutton (options)

cascade (options)

Creates the corresponding type of entry item. Each entry takes its own configuration options, as illustrated above.
add (type,options) The commands above translate to this call.
delete (index1, [index2]) Deletes entry or range of entries.
insert (index1, type, options) Like add, but inserts at the requested index.
entryconfigure (index, options),

entrycget (index)

Configure and retrieve menu entry properties.