Version 5 of radiobutton

Updated 2003-11-07 14:38:06

http://purl.org/tcl/home/man/tcl8.4/TkCmd/radiobutton.htm


Example:

Radio buttons are linked using a common variable, which will have the value of the selected button.

 package require Tk

 set ::onetwothree "3"

 pack [radiobutton .one   -value 1 -text "One"   -variable onetwothree -command { puts $::onetwothree }]
 pack [radiobutton .two   -value 2 -text "Two"   -variable onetwothree -command { puts $::onetwothree }]
 pack [radiobutton .three -value 3 -text "Three" -variable onetwothree -command { puts $::onetwothree }]

The results will be that, on stdout, the number of the radiobutton pressed is output.

Also note that by setting the variable to 3, the 3rd radio button is selected at the beginning of the code.


See the vertical command, which allows to place the text below the checkfield, on the checkbutton page.


Category Widget - Category Command - Tk syntax help - Arts and Crafts of Tcl-Tk Programming