A spinbox widget is a text-entry widget with built-in up and down buttons that are used to either

  • modify a numeric value by setting from, to, increment arguments

  • select among a set of values by using the values argument

tic_spinbox(
  values,
  textvariable,
  command,
  from,
  to,
  increment,
  width,
  bind = NULL,
  pack = NULL,
  ...
)

Arguments

values

Specifies the list of values to display in the spinbox.

textvariable

Reactive value for the value displayed in this widget

command

Function to evaluate when the widget is invoked.

from, to, increment

numeric values for the low value, high value and change in value when the up and down buttons are pressed.

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

The widget implements all the features of the tic_entry() widget.

tcl/tk

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

Examples

opts <- c('alpha', 'bravo', 'charlie')
selected <- reactive_chr(opts[1])
tic_window(
  title = "Demo",
  tic_spinbox(values = opts, textvariable = selected)
)
#> List of 9
#>  $ args     : Named list()
#>  $ type     : chr "window"
#>  $ children :List of 1
#>   ..$ :List of 5
#>   .. ..$ args    :List of 2
#>   .. .. ..$ values      : chr [1:3] "alpha" "bravo" "charlie"
#>   .. .. ..$ textvariable:List of 1
#>   .. .. .. ..$ env:<environment: 0x7f9969774718> 
#>   .. .. .. ..- attr(*, "class")= chr "tclVar"
#>   .. ..$ type    : chr "spinbox"
#>   .. ..$ children: list()
#>   .. ..$ binding : NULL
#>   .. ..$ pack    : NULL
#>  $ binding  : NULL
#>  $ title    : chr "Demo"
#>  $ width    : NULL
#>  $ height   : NULL
#>  $ idle_func: NULL
#>  $ idle_fps : num 30