O'Reilly logo

Learning Perl/Tk by Nancy Walsh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.1. The Checkbutton Widget

In Chapter 3, you learned the options associated with the button widget. A checkbutton is also considered a type of button (and it uses many of the same options), even though the way it is used in an application is different from the way a standard button is used.

Instead of clicking on a checkbutton and expecting something to happen immediately, you use it to indicate a yes or no answer. If the checkbutton is checked it means yes; unchecked means no. You might use a checkbutton to list options for printing a document. The text on the checkbuttons might say Print Header Page, Even Pages Only, Odd Pages Only, and Number Pages. At the bottom of the window there would be a Print button, and when you clicked on it, the program would find out which checkbuttons were selected and submit the print job accordingly.

A window listing several jobs to run (like a batch job controller) might use checkbuttons to ask the user if each job should be run. If the checkbutton next to the job name is selected, the job will be run. If the checkbutton is unselected, then the job will be skipped this time around.

Each time a checkbutton is used, the application is asking the user to answer a yes or no question. Checkbuttons that make up a group are typically related (as in our print job example), but they don't have to be because the answer to each checkbutton is independent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required