The widget roundup provides you with a quick and easy reference to the most important features and options for each Tk widget.


Widget Essentials

When to use: Use three or more (up to about five or six maximum) to allow the user to choose between several mutually exclusive options.
Tcl:ttk::radiobutton .ra -text "Alpha" -variable release -value 0
ttk::radiobutton .rb -text "Beta" -variable release -value 1
ttk::radiobutton .rp -text "Prod" -variable release -value 2
Ruby:$release = ( initialValue );
ra = {text "Alpha"; 
   variable $release; value 0}
rb = {text "Beta"; 
   variable $release; value 1}
rp = {text "Prod"; 
   variable $release; value 2}
Perl:my $ra = parent->new_ttk__radiobutton
   -text => "Alpha", -variable => $release, -value => 0);
my $rb = parent->new_ttk__radiobutton
   -text => "Beta", -variable => $release, -value => 1);
my $rp = parent->new_ttk__radiobutton
   -text => "Prod", -variable => $release, -value => 2);
Python:release = StringVar()
ra = ttk.Radiobutton(parent, text="Alpha", 
   variable=release, value=0)
rb = ttk.Radiobutton(parent, text="Beta", 
   variable=release, value=1)
rp = ttk.Radiobutton(parent, text="Prod", 
   variable=release, value=2)
Reference: (at

Common Options

text The text label to be shown next to the radiobutton itself.
variable A variable linked to the radiobutton; when the variable is changed, the radiobutton will reflect the new value, while if the user selects the radiobutton, the variable's value will be updated. If the variable has not been initialized, the radiobutton is shown in an indeterminate state, which usually implies that a choice has not yet been made (and that a default choice is inappropriate).
value Value to use when that radiobutton is selected. If the linked variable contains this value, the radiobutton is selected (filled in), otherwise it is unselected (empty).

How do I...

See which radiobutton is selected? Look at the linked variable.
Change which radiobutton is selected? Change the linked variable to the value of the radiobutton you'd like to select.
See if it's in the indeterminate state? Check if the variable has not been initialized.
You can also use the "instate alternate" method.
Disable the checkbutton? Use the "state disabled" method.
You can reenable this with "state !disabled".
Check with "instate disabled" (returns 1 if disabled, else 0).

Less Common Options

textvariable As an alternative to text, get the string from a variable, updating when the variable changes.
command The script to invoke when the radiobutton is pressed.
Specify a Tk Image object (not the path to an image file) instead of the text label. If compound is center, top, bottom, left, or right, display the text and the image.