Creating a menu

In Tk the menu is not just a name for a part of your GUI, but also the actual widget command name as well. The menu command will create a new menu widget.

The syntax is as follows:

	menu name option value…

The menu command accepts one or more option value pairs, as detailed in the following table:

Option

Interpretation

-accelerator

Specifies an accelerator or keyboard hotkeys to be displayed to the right-hand side of the menu text. The specific acceptable values are dependent on the display manager in use. For example, in a Windows application, Control+N would be an acceptable value.

-activebackground

Specifies the background color to be used when drawing the element. The active background is the color used when the mouse ...

Get Tcl/Tk 8.5 Programming Cookbook 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.