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.
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:
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.
Indicates the last entry.
Where the location cursor is currently poised. The active location appears underlined.
Indicates that none are active. Used along with activate() to deactivate all entries.
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 .
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 |
entryconfigure (index, options), entrycget (index) |
Copyright © 2001 O'Reilly & Associates. All rights reserved.