Chapter 4. Button, Checkbutton, and Radiobutton Widgets
Almost all Perl/Tk applications use Buttons in one way or another. There are three different types of Button widgets available in the standard Perl/Tk set: Button, Checkbutton, and Radiobutton. This chapter covers all three types of Buttons and includes examples of where you might use one over the other.
Each of the Buttons we cover in this chapter look different, primarily in their use of selection indicators. The Button widget doesn’t use indicators at all, but Checkbutton and Radiobutton widgets use them to indicate whether the Button has been selected or not. The Button widgets are:
- Button
A plain Button, shown in Figure 4-1. The user can press it and usually an immediate action results.
Figure 4-1. Button widget
- Checkbutton
A Checkbutton, shown checked in Figure 4-2. When checked or unchecked, only the visual representation is changed; the state is not validated until later in the program. Checkbuttons can be used singly or in groups.
Figure 4-2. Checkbutton widget
- Radiobutton
A Radiobutton, shown unchecked in Figure 4-3. When checked or unchecked, only the visual representation is changed; the state is not validated until later in the program. Radiobuttons are always used in groups of two or more.
Figure 4-3. Radiobutton ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access