Options

Table 31-2. Menu Options

Option

Type

Description

activebackground

color

activeborderwidth

distance

activeforeground

color

background (bg)

color

borderwidth (bd)

distance

cursor

cursor

The cursor to show when the mouse pointer is placed over the button widget. Default is a system specific arrow cursor.

disabledforeground

color

font

font

foreground (fg)

color

postcommand

callback

If given, this callback is called whenever Tkinter is about to display this menu. If you have dynamic menus, use this callback to update their contents.

relief

constant

Border decoration. The default is RAISED. Other possible values are FLAT, SUNKEN, GROOVE, and RIDGE.

selectcolor

color

takefocus

flag

Indicates that the user can use the Tab key to move to this widget. Default is an empty string, which means that the menu accepts focus only if it has any keyboard bindings (default is on, in other words).

tearoff

flag

If set, menu entry 0 will be a "tearoff entry", which is usually a dashed separator line. If the user selects this entry, Tkinter creates a small Toplevel with a copy of this menu.

This is on by default, so if you're writing code for Windows and Macintosh, you may want to explicitly set this option to false to make sure the menus looks as people expect them to.

tearoffcommand

callback

If given, this callback is called when this menu is teared off (that is, if the tearoff option is set, and the user clicks on the "tearoff entry".)

title

string

type

constant