Common Widget Configuration Options

In the remainder of this chapter, we’ll discuss each widget, the commands used to create each widget, the options used to configure them, and the methods for manipulating them.

You’ll find that there are many, many configuration options shared by multiple widgets. We could list them individually for each widget, but in the interest of saving a tree or two, we will instead list the shared options up front rather than repeating them over and over. That way, we can concentrate on the options that are crucial to the behavior of each particular widget and save the reader from being lost in a sea of options.

The following options are supported by the widgets noted:

-activebackground => color

Sets the background color when the mouse cursor is over the widget. Applicable widgets: Button, Checkbutton, Menu, Menubutton, Optionmenu, Radiobutton, Scale, Scrollbar.

-activeborderwidth => borderwidth

Sets a 3-D border around active elements. Applicable widgets: Menu, Menubutton, Optionmenu.

-activeforeground => color

Sets the text color when the mouse cursor is over the widget. Applicable widgets: Button, Checkbutton, Menu, Menubutton, Optionmenu, Radiobutton.

-anchor => position

Causes the text to stick to that position in the widget. Values for position are n, ne, e, se, s, sw, w, nw, and center. Applicable widgets: Button, Checkbutton, Label, Menubutton, Optionmenu, Radiobutton.

-background => color-bg => color

Sets the background of the widget to the specified color. ...

Get Perl in a Nutshell, 2nd Edition 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.