Buttons Associated with Tcl Variables

The checkbutton and radiobutton widgets are associated with a global Tcl variable. When one of these buttons is clicked, a value is assigned to the Tcl variable. In addition, if the variable is assigned a value elsewhere in the program, the appearance of the checkbutton or radiobutton is updated to reflect the new value. A set of radiobuttons all share the same global variable. The set represents a choice among mutually exclusive options. In contrast, each checkbutton has its own global variable.

The ShowChoices example uses a set of radiobuttons to display a set of mutually exclusive choices in a user interface. The ShowBooleans example uses checkbutton widgets:

Example 27-4 Radiobuttons and checkbuttons. ...

Get Practical Programming in Tcl & Tk, Third 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.