Menu Item Options
In addition to the menu itself, each individual menu item can
be configured. The widget configuration options that apply to menu
items are: -activebackground,
-background, -bg, -bitmap, -font, -foreground, -fg, -image, -state, and -underline. Other options are:
-acceleratorDisplays an accelerator key sequence for the menu item. The key sequence must be independently defined with a
bind.-command =>callbackPointer to a function that will be called when the menu item is selected.
-indicatoron =>booleanDetermines whether to display an indicator.
-label =>stringThe string to use as a label for the menu item.
-menu =>$submenuFor a cascade menu, points to the menu to embed.
-offvalue =>newvalueFor a checkbutton, specifies the value used when the checkbutton is off.
-onvalue =>newvalueFor a checkbutton, specifies the value used when the checkbutton is on.
-selectcolor =>colorFor a checkbutton or radiobutton, color of the indicator when on.
-selectimage =>imgptrFor a checkbutton or radiobutton, defines the image to be displayed instead of text when the radiobutton is on. Ignored if
-imageis not used.-value =>valueFor a radiobutton, sets
$variableto the specified value when the radiobutton is selected (default is1).-variable =>\$variableAssociates the value of the menu item to the specified variable.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access