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:

number

The index of the entry, starting from 0. When the tear-off option is active, the 0th entry is a separator automatically inserted by the menu.

end, last

Indicates the last entry.

active

Where the location cursor is currently poised. The active location appears underlined.

none

Indicates that none are active. Used along with activate() to deactivate all entries.

pattern

A pattern to be matched against all entries. Currently, only exact matches are guaranteed to work.

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 ...

Get Advanced Perl Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.