Radiobutton widgets are used in groups to show or change a set of mutually-exclusive options.

tic_radiobutton(
  text,
  value,
  variable,
  command,
  textvariable,
  width,
  bind = NULL,
  pack = NULL,
  ...
)

Arguments

text

Specifies a text string to be displayed inside the widget.

text

Simple character string containing the name

textvariable

Reactive variable containing a string

value

The value to store in the associated variable when the widget is selected.

variable

The reactive variable holding the state for a set of radiobuttons.

command

Function to evaluate when the widget is invoked.

textvariable

Specifies a text string to be displayed inside the widget.

text

Simple character string containing the name

textvariable

Reactive variable containing a string

width

If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used.

bind

bind commands to particular events on this element. This may be a single result of bind_opts() or a list of them for multiple events.

pack

a named list of pack options for how to incorporate this element into its parent container. Default: NULL means to use the standard packing. See pack_opts() as a way of creating a valid list of pack options.

...

Other arguments are parsed as follows:

named arguments

Further options to be used during the creation of this widget. See the tcl/tk documentation for all arguments possible for this widget.

unnamed arguments

Container widgets (e.g. tic_frame()) treat any unnamed arguments as child objects. Non-container widgets (e.g tic_button()) will raise an error if there are any unnamed widgets.

Value

handle on the tcl/tk object

Details

Radiobuttons are linked to a reactive variable, and have an associated value; when a radiobutton is clicked, it sets the variable to its associated value.

tcl/tk

See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_radiobutton.htm

Examples

choices <- c('alpha', 'bravo', 'charlie')
state <- reactive_chr(choices[1])
tic_window(
  title = "demo",
  tic_radiobutton(text = choices[1], value = choices[1], variable = state),
  tic_radiobutton(text = choices[2], value = choices[2], variable = state),
  tic_radiobutton(text = choices[3], value = choices[3], variable = state)
)
#> List of 9
#>  $ args     : Named list()
#>  $ type     : chr "window"
#>  $ children :List of 3
#>   ..$ :List of 5
#>   .. ..$ args    :List of 3
#>   .. .. ..$ text    : chr "alpha"
#>   .. .. ..$ value   : chr "alpha"
#>   .. .. ..$ variable:List of 1
#>   .. .. .. ..$ env:<environment: 0x7f996e3ecaa0> 
#>   .. .. .. ..- attr(*, "class")= chr "tclVar"
#>   .. ..$ type    : chr "radiobutton"
#>   .. ..$ children: list()
#>   .. ..$ binding : NULL
#>   .. ..$ pack    : NULL
#>   ..$ :List of 5
#>   .. ..$ args    :List of 3
#>   .. .. ..$ text    : chr "bravo"
#>   .. .. ..$ value   : chr "bravo"
#>   .. .. ..$ variable:List of 1
#>   .. .. .. ..$ env:<environment: 0x7f996e3ecaa0> 
#>   .. .. .. ..- attr(*, "class")= chr "tclVar"
#>   .. ..$ type    : chr "radiobutton"
#>   .. ..$ children: list()
#>   .. ..$ binding : NULL
#>   .. ..$ pack    : NULL
#>   ..$ :List of 5
#>   .. ..$ args    :List of 3
#>   .. .. ..$ text    : chr "charlie"
#>   .. .. ..$ value   : chr "charlie"
#>   .. .. ..$ variable:List of 1
#>   .. .. .. ..$ env:<environment: 0x7f996e3ecaa0> 
#>   .. .. .. ..- attr(*, "class")= chr "tclVar"
#>   .. ..$ type    : chr "radiobutton"
#>   .. ..$ children: list()
#>   .. ..$ binding : NULL
#>   .. ..$ pack    : NULL
#>  $ binding  : NULL
#>  $ title    : chr "demo"
#>  $ width    : NULL
#>  $ height   : NULL
#>  $ idle_func: NULL
#>  $ idle_fps : num 30