4.2. Standard Options for Each Button TypeBefore we get into all the options available for each of the Button widgets, let's take a look at the most common ones. When creating a Button, use the -text and -command options. The -text option lets the user know what the Button is for, and the -command option makes something happen when the user clicks the Button.
When creating Checkbuttons, you use -variable in addition to -text. Using -variable gives you an easy way to find out whether the Checkbutton is checked. (You will rarely use -command with a Checkbutton):
The value stored in $print_header is 1 or 0. A simple test will tell you if the Checkbutton was checked. When creating Radiobuttons, we always create more than one and use the -text, -variable, and -value options:
The variable $group1 relates all of the Radiobuttons, making it so the user can select only one at a time. Each Radiobutton must be given a -value to store in $group1 (there is no default).
Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|