A checkbutton is used to show or change a setting. It has two states,
selected
and deselected
.
tic_checkbutton(
text,
variable,
command,
textvariable,
width,
style,
bind = NULL,
pack = NULL,
...
)
Specifies a text string to be displayed inside the widget.
text
Simple character string containing the name
textvariable
Reactive variable containing a string
The variable containing the state of the button. Create this
variable with reactive_lgl
.
Function to evaluate when the widget is invoked.
Specifies a text string to be displayed inside the widget.
text
Simple character string containing the name
textvariable
Reactive variable containing a string
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.
Default behaviour is to use a checkbox stye button. With the build in theme in this package, two other styles are possible:
''toggle
The button will look like a regular button but will alternate between 'on' and 'off' states with each press
'switch'
The button will look like a sliding switch which slides from one side to the other with each press
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.
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.
handle on the tcl/tk object
The state of the checkbutton should be linked to a reactive_lgl
logical variable using
variable
argument.
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_checkbutton.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_combobox()
,
tic_label()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_progressbar()
,
tic_radiobutton()
,
tic_separator()
,
tic_sizegrip()
,
tic_slider()
,
tic_spinbox()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
alert = reactive_lgl(FALSE)
tic_window(
title = "demo",
tic_checkbutton(text = "Click for Alert", variable = alert)
)
#> List of 9
#> $ args : Named list()
#> $ type : chr "window"
#> $ children :List of 1
#> ..$ :List of 5
#> .. ..$ args :List of 2
#> .. .. ..$ text : chr "Click for Alert"
#> .. .. ..$ variable:List of 1
#> .. .. .. ..$ env:<environment: 0x7f996dbcdc28>
#> .. .. .. ..- attr(*, "class")= chr "tclVar"
#> .. ..$ type : chr "checkbutton"
#> .. ..$ children: list()
#> .. ..$ binding : NULL
#> .. ..$ pack : NULL
#> $ binding : NULL
#> $ title : chr "demo"
#> $ width : NULL
#> $ height : NULL
#> $ idle_func: NULL
#> $ idle_fps : num 30