[Tk]'s radiobutton widget documentation can be found at http://purl.org/tcl/home/man/tcl8.5/TkCmd/radiobutton.htm while [Ttk]'s radiobutton widget documentation can be found at http://www.tcl.tk/man/tcl8.5/TkCmd/ttk_radiobutton.htm . Using a radiobutton '''as''' a radiobutton generally means that there are two or more of them. In the old days (pre-cassettes and CDs), an automobile's radio often had this idea of a set of mutually exclusive buttons. Each button would (if the owner could figure out how to do it) have a radio station associated with it. When someone would select a station by pressing one of the buttons, it would stay down, and the radio would be tuned to the station that had been associated with that button. When the next radio button was selected by being pressed, the previous one would return to the unselected state. Thus, in theory (if the hardware was working) only one button would be selected at a time. Tk's radiobutton concept works similarly. One creates one or more buttons, and ''ties them together'' by supplying a variable name via the '''-variable''' argument. Each button with the same variable toggles on or off. For the programmer to know which button is selected, they provide a unique string to the '''-value''' argument. That value is assigned to the variable when the button has been selected. If one wishes, they can also associate a command to be executed at the time a radiobutton has been selected. The radiobutton itself consists of an "image". This image changes depending on the mouse actions within the group. For instance, the radiobutton has an initial state. Then moving the mouse over the radiobutton, but not pressing, changes the look of the default radiobutton. Finally, pressing the radiobutton changes the look yet again. ---- '''Tk 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 "WNBC" -text "New York" -variable onetwothree -command { puts "Play $::onetwothree" }] pack [radiobutton .two -value "KDKA" -text "Pittsburgh" -variable onetwothree -command { puts "Play $::onetwothree" }] pack [radiobutton .three -value "WGN" -text "Chicago" -variable onetwothree -command { puts "Play $::onetwothree" }] The results will be that, on stdout, the number of the radiobutton pressed is output. By setting the onetwothree global variable to 3, the 3rd radio button is selected at the beginning of the code. The global variable used with radiobuttons probably should exist, even if just set to an empty string, to ensure the initial state of the buttons is set as expected. ---- See the ''vertical'' command, which allows to place the text below the checkfield, on the [checkbutton] page. ---- '''See also''' * [Lightbutton] a pure Tcl package mimicking the radio and the check buttons, with bright and pretty colors. ---- !!!!!! %| [Category Widget] | [Category Command] of [Tk] |% [Tk syntax help] - [Arts and Crafts of Tcl-Tk Programming] !!!!!!