The Menu widget supports the standard Tkinter Widget interface (with the exception of the geometry manager methods), plus the following methods:
Add (append) an entry of the given type to the menu. The type argument can be one of "command", "cascade" (submenu), "checkbutton", "radiobutton", or "separator". The options are as defined in the following table:
Table 31-1. Menu Item Options
Option | Type | Description |
---|---|---|
activebackground | color | |
activeforeground | color | |
accelerator | string | |
background | color | |
bitmap | bitmap | |
columnbreak | flag | |
command | callback | |
font | font | |
foreground | color | |
hidemargin | flag | |
image | image | |
indicatoron | flag | |
label | string | |
menu | widget | |
offvalue | value | |
onvalue | value | |
selectcolor | color | |
selectimage | image | |
state | constant | |
underline | integer | |
value | value | |
variable | variable |
Convenience functions, used to add items of the given type.
Same as add and friends, but inserts the new item at the given index.
Reconfigure the given menu entry. Only the given options are changed; the rest are left as is.
Convert an index (of any kind) to an integer index.
Delete one or more menu entries.
Invoke the given entry (just like if the user had clicked on it).
Display the menu at the given position. The position should be given in pixels, relative to the root window.
Remove a posted menu.
Return the vertical offset for the given entry. This can be used to position a popup menu so that a given entry is under the the mouse when the menu appears.