Title: | Easily Build Tcl/Tk UIs |
---|---|
Description: | Wrap tcltk to make GUI creation easier. |
Authors: | mikefc |
Maintainer: | mikefc <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-15 04:52:19 UTC |
Source: | https://github.com/coolbutuseless/tickle |
tic_ui
objectsThis autocomplete helper removes 'type' and 'env' from the suggestions, and moves the suggestion of 'ID' to last in the list.
## S3 method for class 'tic_ui' .DollarNames(x, pattern)
## S3 method for class 'tic_ui' .DollarNames(x, pattern)
x |
object |
pattern |
current pattern to match |
This is because the user is most often going to be using this object to havigate the element tree, and will rarely need to access anything other than the named child nodes.
tic_ui
objectCreate a character representation of a tic_ui
object
## S3 method for class 'tic_ui' as.character(x, depth = 0L, ...)
## S3 method for class 'tic_ui' as.character(x, depth = 0L, ...)
x |
tic_ui object |
depth |
recusive depth |
... |
ignored |
The bind command associates R functions with UI events.
bind_event(tag, event, command) bind_opts(event, command)
bind_event(tag, event, command) bind_opts(event, command)
tag |
the |
event |
the event to watch for on this object. The general form of an event is "modifiers-type-detail" |
command |
R function to run when this even occurs. |
bind_opts
is used to define binding events within the UI spec.
After the UI is created (with a call to win = render_ui(ui_spec)
),
events can be bound with bind_event(...)
.
"c"
keyboard character 'c'
"Control-q"
Key combination CTRL+q
"ButtonPress"
Any button press
"KeyPress"
Any keypress
"Double-Button-1"
Double click on Mouse Button number 1
Control, Alt, Shift, Lock, Button1-Button5, Mod1-Mod5, Meta Double, Triple, Quadruple
Activate, ButtonPress, Button, ButtonRelease, Circulate, CirculateRequest, Configure, ConfigureRequest, Create, Deactivate, Destroy, Enter, Expose, FocusIn, FocusOut, Gravity, KeyPress, Key, KeyRelease, Leave, Map, MapRequest, Motion, MouseWheel, Property, Reparent, ResizeRequest, Unmap, Visibility
Variables available to the command
depend upon the event. See
https://www.tcl.tk/man/tcl8.6/TkCmd/bind.html for the full list.
some variables are listed here:
b
The number of the button that was pressed or released. Valid only for ButtonPress and ButtonRelease events.
k
The keycode field from the event. Valid only for KeyPress and KeyRelease events.
K
The keysym corresponding to the event, substituted as a textual string. Valid only for KeyPress and KeyRelease events.
t
time stamp of the event
x,y
indicate the position of the mouse pointer relative to the UI window.
X, Y
indicate the position of the mouse pointer in absolute screen coordinates
D
This reports the delta value of a MouseWheel event. The delta value represents the rotation units the mouse wheel has been moved. The sign of the value represents the direction the mouse wheel was scrolled.
See tcl/tk documentation for more information on binding commands to events https://www.tcl.tk/man/tcl8.6/TkCmd/bind.html
## Not run: # Every mouse press prints coordinates ui_spec <- tic_window() win <- render_ui(ui_spec) bind_event(win, "Button", function(t, x, y, ...) { message(t, ": ", x, ", ", y)}) ## End(Not run)
## Not run: # Every mouse press prints coordinates ui_spec <- tic_window() win <- render_ui(ui_spec) bind_event(win, "Button", function(t, x, y, ...) { message(t, ": ", x, ", ", y)}) ## End(Not run)
Draw an arc on a canvas
canvas_arc( canvas, x1, y1, x2, y2, start, extent, style, fill, outline, width, dash, ... )
canvas_arc( canvas, x1, y1, x2, y2, start, extent, style, fill, outline, width, dash, ... )
canvas |
a |
x1 , y1 , x2 , y2
|
he coordinates of two diagonally opposite corners of a rectangular region enclosing the oval that defines the arc |
start |
starting angle of arc in degrees measured counter-clockwise from the "3 o'clock" position. Value in range [-360, 360] |
extent |
Size of te angle range occupied by the arc. Value in range [-360, 360] |
style |
how to draw the arc. One of: pieslice (default), chord, fill
|
fill |
line colour |
outline |
outline colour |
width |
line width e.g. |
dash |
Specifies the line's dash pattern. This should be a numeric
vector with alternating lengths of "dash" and "space-between-dash".
E.g. |
... |
other line creation options. See https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M26 |
Other canvas:
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
Clear the canvas of all objects
canvas_clear(canvas)
canvas_clear(canvas)
canvas |
a |
Other canvas:
canvas_arc()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
Render an image a canvas
canvas_image(canvas, x, y, image, anchor, ...)
canvas_image(canvas, x, y, image, anchor, ...)
canvas |
a |
x , y
|
coorindates for image |
image |
as loaded by |
anchor |
anchor point within image for positioning. default: center Possible values: n, s, e, w, ne, nw, se, sw, center |
... |
other line creation options. See https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M26 |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
Draw a line on a canvas
canvas_line( canvas, xs, ys, fill, width, arrow, smooth, capstyle, joinstyle, dash, ... )
canvas_line( canvas, xs, ys, fill, width, arrow, smooth, capstyle, joinstyle, dash, ... )
canvas |
a |
xs , ys
|
vectors of coordinates |
fill |
line colour |
width |
line width e.g. |
arrow |
where are arrowheads to be drawn? Default: 'none'. Possible values: 'none', 'first', 'last', 'both' |
smooth |
should the line be draw as quadratic beziers instead of line segements? logical. default: FALSE |
capstyle |
Specifies the ways in which caps are to be drawn at the endpoints of the line: Possible values: butt, projecting, or round. If this option is not specified then it defaults to butt. Where arrowheads are drawn the cap style is ignored. |
joinstyle |
Specifies the ways in which joints are to be drawn at the vertices of the line. Possible values: bevel, miter, or round). If this option is not specified then it defaults to round. |
dash |
Specifies the line's dash pattern. This should be a numeric
vector with alternating lengths of "dash" and "space-between-dash".
E.g. |
... |
other line creation options. See https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M26 |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
Draw an oval on a canvas
canvas_oval(canvas, x1, y1, x2, y2, fill, outline, width, dash, ...)
canvas_oval(canvas, x1, y1, x2, y2, fill, outline, width, dash, ...)
canvas |
a |
x1 , y1 , x2 , y2
|
corners of rectangle enclosing the oval |
fill |
line colour |
outline |
outline colour |
width |
line width e.g. |
dash |
Specifies the line's dash pattern. This should be a numeric
vector with alternating lengths of "dash" and "space-between-dash".
E.g. |
... |
other line creation options. See https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M26 |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
Render a plot to the canvas
canvas_plot(canvas, plot, width, height, x = 0, y = 0, anchor = "nw")
canvas_plot(canvas, plot, width, height, x = 0, y = 0, anchor = "nw")
canvas |
a |
plot |
object to be plotted. Anything support by |
width , height
|
size of plot in pizels |
x , y
|
coorindates for image. default (0, 0) |
anchor |
anchor point within image for positioning. default: nw Possible values: n, s, e, w, ne, nw, se, sw, center |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
Draw a polygon on a canvas
canvas_polygon( canvas, xs, ys, fill, outline, width, smooth, joinstyle, dash, ... )
canvas_polygon( canvas, xs, ys, fill, outline, width, smooth, joinstyle, dash, ... )
canvas |
a |
xs |
vectors of coordinates |
ys |
vectors of coordinates |
fill |
line colour |
outline |
outline colour |
width |
line width e.g. |
smooth |
should the line be draw as quadratic beziers instead of line segements? logical. default: FALSE |
joinstyle |
Specifies the ways in which joints are to be drawn at the vertices of the line. Possible values: bevel, miter, or round). If this option is not specified then it defaults to round. |
dash |
Specifies the line's dash pattern. This should be a numeric
vector with alternating lengths of "dash" and "space-between-dash".
E.g. |
... |
other line creation options. See https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M26 |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
Draw a polygon on a canvas
canvas_rect(canvas, x1, y1, x2, y2, fill, outline, width, dash, ...)
canvas_rect(canvas, x1, y1, x2, y2, fill, outline, width, dash, ...)
canvas |
a |
x1 , y1 , x2 , y2
|
corners of rectangle |
fill |
line colour |
outline |
outline colour |
width |
line width e.g. |
dash |
Specifies the line's dash pattern. This should be a numeric
vector with alternating lengths of "dash" and "space-between-dash".
E.g. |
... |
other line creation options. See https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M26 |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_save()
,
canvas_text()
,
tic_canvas()
tcl/tk only exports the canvas as a PS (Postscript) file. In this function,
the magick
package is used to read the postscript file and render it
to an image file based upon the suffix supplied in the filename
argument.
canvas_save(canvas, filename, ps_density = NULL, ...)
canvas_save(canvas, filename, ps_density = NULL, ...)
canvas |
a |
filename |
where the image should be saved. The image suffix will be
used as the |
ps_density |
DPI. Resolution to postscript document. This corresponds to
the |
... |
all other arguments passed to |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_text()
,
tic_canvas()
Draw text on a canvas
canvas_text(canvas, x, y, text, fill, justify, angle, ...)
canvas_text(canvas, x, y, text, fill, justify, angle, ...)
canvas |
a |
x , y
|
coorindates for text |
text |
string to display |
fill |
text colour |
justify |
one of 'left', 'right', 'center'. Default: left |
angle |
default: 0 |
... |
other line creation options. See https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html#M26 |
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
tic_canvas()
tic_ui
treeExtract a nide from a tic_ui
tree
extract_node_by_id(ui, id)
extract_node_by_id(ui, id)
ui |
a |
id |
the id of the path. An ID string of the |
Format/print a reactive value
## S3 method for class 'reactive_value' format(x, ...) ## S3 method for class 'reactive_textbox' format(x, ...) ## S3 method for class 'reactive_value' print(x, ...)
## S3 method for class 'reactive_value' format(x, ...) ## S3 method for class 'reactive_textbox' format(x, ...) ## S3 method for class 'reactive_value' print(x, ...)
x |
object |
... |
ignored |
Sanitize an argument list to replace any image paths with a tkimage object
handle_images(args)
handle_images(args)
args |
list of args as part of a |
list of args with any image
arguments replaced by a tkimage
object
To stop the function:
Close the window it is attached to
Use a global logical value that is consulted inside the user func to determine if any action should be taken
launch_idle_func(win, user_func, fps = 30, initial_delay = 100)
launch_idle_func(win, user_func, fps = 30, initial_delay = 100)
win |
top level window object |
user_func |
users R function. This function will be called within the idle loop within any argumnets |
fps |
desired frame rate. default: 30 |
initial_delay |
initial delay before running function for the first time. In milliseconds. Default: 1000 |
List all the font families present
list_font_families()
list_font_families()
character vector of names
Get a list of active themes
list_themes()
list_themes()
These pack options specify how a widget is packed into its parent element.
pack_opts(anchor, expand, fill, ipadx, ipady, padx, pady, side, ...)
pack_opts(anchor, expand, fill, ipadx, ipady, padx, pady, side, ...)
anchor |
Specify where to position content within its parent. Defaults to 'center'. The alternative is to specify a string consisting only of the letters 'n', 's', 'e', 'w', to indicate the compass direction to anchor to. e.g. 'w', or 'sw' for 'west' (left) or 'southwest' respectively. |
expand |
Should the content should be expanded to consume extra space in its parent container? Default: TRUE |
fill |
If parent size is larger than its requested dimensions, this option may be used to stretch the content.
|
ipadx , ipady
|
How much horizontal/vertical internal padding to leave on the side of each element. If you are familiar with HTML/CSSThis is analogous to
CSS |
padx , pady
|
How much horizontal/vertical external padding to leave on the side of each element. This may be two values in order to specify different padding for left vs right, or top vs bottom. If you are familiar with HTML/CSSThis is analogous to
CSS |
side |
Which side of the container the content will be packed against? Possible values: left, right, top, bottom |
... |
extra named args used by the packing spec. |
See tcl/tk documentation for more information on the packing specification https://www.tcl.tk/man/tcl8.6/TkCmd/pack.html
Create a popup window for choosing a colour
popup_color_picker(title = "Choose colourr", ...)
popup_color_picker(title = "Choose colourr", ...)
title |
Title to display on popup window |
... |
other named arguments used to initialise this widget |
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/chooseColor.html
## Not run: popup_color_picker(message = 'hello') ## End(Not run)
## Not run: popup_color_picker(message = 'hello') ## End(Not run)
Display a popup message box
popup_messagebox(message, type, title, ...)
popup_messagebox(message, type, title, ...)
message |
message to display. Required. |
type |
one of 'abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel' |
title |
window title |
... |
other options (experts) |
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/messageBox.html
## Not run: popup_messagebox(message = 'hello') ## End(Not run)
## Not run: popup_messagebox(message = 'hello') ## End(Not run)
Dialogs for choosing a file to open and save
popup_open_file(multiple, ...) popup_save_file(confirmoverwrite, ...)
popup_open_file(multiple, ...) popup_save_file(confirmoverwrite, ...)
multiple |
allow the user to choose multiple files? default: FALSE |
... |
other arguments. See tcltk documentation for all possible options |
confirmoverwrite |
If user selects a filename which already exists, then show another popup to confirm overwriting this file. Default: TRUE. |
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/getOpenFile.html
print a tic_spec
## S3 method for class 'tic_spec' print(x, ...)
## S3 method for class 'tic_spec' print(x, ...)
x |
|
... |
ignored |
tic_ui
objectPrint a tic_ui
object
## S3 method for class 'tic_ui' print(x, ...)
## S3 method for class 'tic_ui' print(x, ...)
x |
|
... |
ignored |
Create a reactive variable
reactive_lgl(value = FALSE) reactive_int(value = 0L) reactive_chr(value = "") reactive_dbl(value = 0) reactive_textbox(value)
reactive_lgl(value = FALSE) reactive_int(value = 0L) reactive_chr(value = "") reactive_dbl(value = 0) reactive_textbox(value)
value |
initial value. |
Render a complete UI given a spec for a window with child elements
render_ui(spec, parent = NULL)
render_ui(spec, parent = NULL)
spec |
UI spec as created using |
parent |
parent object. The default 'NULL' value is only allowed
for |
a nested named list of tcl objects making up the UI. For advanced users
that want to do low-level manipulation of the window, these
tclObj
objects are a key argument to functions in
the tcltk
package.
The key side effect of this function is that a tcl/tk window will be opened and rendered to this specficiation.
Set the font family
set_font_family(body = NULL, headings = body)
set_font_family(body = NULL, headings = body)
body |
name of font family for body text, buttons, menus etc |
headings |
name of the font family for the h1-h5 headings for labels.
by default this will be set to the same as the |
Globally scale the fonts in the rendered UI
set_font_scale(scale)
set_font_scale(scale)
scale |
numeric scale factor. default 1.0 |
none.
For advanced users, you can load a theme from a file using
tcltk::tcl('source', theme_file)
, before calling set_theme()
set_theme(theme_name = "r-sun-valley-light")
set_theme(theme_name = "r-sun-valley-light")
theme_name |
name of theme. By default this will load the built-in
theme developed for R.
Use |
none
{ ## Not run: list_themes() set_theme('default') ## End(Not run) }
{ ## Not run: list_themes() set_theme('default') ## End(Not run) }
A button widget displays a textual label and/or image, and evaluates a command when pressed.
tic_button( text, command, textvariable, image, compound, width, bind = NULL, pack = NULL, ... )
tic_button( text, command, textvariable, image, compound, width, bind = NULL, pack = NULL, ... )
text , textvariable
|
Specifies a text string to be displayed inside the widget.
|
command |
Function to evaluate when the widget is invoked. |
image |
pathname of image to display |
compound |
Specifies how to display the image relative to the text,
in the case both
|
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 |
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 |
... |
Other arguments are parsed as follows:
|
A tic_spec
object containing the widget specification.
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm
Other widgets:
tic_canvas()
,
tic_checkbutton()
,
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()
## Not run: tic_window( title = "Hello", tic_button(text = "Button", command = function() { message("Button clicked") }) ) ## End(Not run)
## Not run: tic_window( title = "Hello", tic_button(text = "Button", command = function() { message("Button clicked") }) ) ## End(Not run)
This command will create a canvas widget as part of UI creation, but all the interesting things the user would want to do with a canvas are interactive things after the UI is available to the user.
tic_canvas( background = "#fafafa", scrollbars = FALSE, bind = NULL, pack = NULL, ... )
tic_canvas( background = "#fafafa", scrollbars = FALSE, bind = NULL, pack = NULL, ... )
background |
Background colour. Default: '#fafafa' |
scrollbars |
include scrollbars on the canvas? Default: FALSE. This option has not really been tested. Scrollbars still look funky. |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
... |
Other arguments are parsed as follows:
|
So to make actual use of canvas at the moment, you'll have to be prepared to write some code with the 'tcltk' package and read lots of documentation!
handle on the tcl/tk object. TODO: better language needed here.
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/canvas.html
Other widgets:
tic_button()
,
tic_checkbutton()
,
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()
Other canvas:
canvas_arc()
,
canvas_clear()
,
canvas_image()
,
canvas_line()
,
canvas_oval()
,
canvas_plot()
,
canvas_polygon()
,
canvas_rect()
,
canvas_save()
,
canvas_text()
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, ... )
tic_checkbutton( text, variable, command, textvariable, width, style, bind = NULL, pack = NULL, ... )
text |
Specifies a text string to be displayed inside the widget.
|
variable |
The variable containing the state of the button. Create this
variable with |
command |
Function to evaluate when the widget is invoked. |
textvariable |
Specifies a text string to be displayed inside the widget.
|
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. |
style |
Default behaviour is to use a checkbox stye button. With the build in theme in this package, two other styles are possible:
|
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
... |
Other arguments are parsed as follows:
|
The state of the checkbutton should be linked to a reactive_lgl
logical variable using
variable
argument.
handle on the tcl/tk object
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) )
alert = reactive_lgl(FALSE) tic_window( title = "demo", tic_checkbutton(text = "Click for Alert", variable = alert) )
A combobox combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list.
tic_combobox( values, textvariable, justify, state, width, bind = NULL, pack = NULL, ... )
tic_combobox( values, textvariable, justify, state, width, bind = NULL, pack = NULL, ... )
values |
Specifies the list of values to display in the drop-down listbox. |
textvariable |
Reactive value for the current selected value in this widget |
justify |
one of |
state |
one of |
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 |
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 |
... |
Other arguments are parsed as follows:
|
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_combobox.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
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()
opts <- c('alpha', 'bravo', 'charlie') selected <- reactive_chr(opts[1]) tic_window( title = "Demo", tic_combobox(values = opts, textvariable = selected) )
opts <- c('alpha', 'bravo', 'charlie') selected <- reactive_chr(opts[1]) tic_window( title = "Demo", tic_combobox(values = opts, textvariable = selected) )
Create a text label
tic_label(text, textvariable, width, style, bind = NULL, pack = NULL, ...)
tic_label(text, textvariable, width, style, bind = NULL, pack = NULL, ...)
text |
Specifies a text string to be displayed inside the widget.
|
textvariable |
Specifies a text string to be displayed inside the widget.
|
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. |
style |
specify the style for this label. Possible values are "h1" through "h5" which are analogues to the h1 to h5 headings in HTML, with "h1" being the largest heading size, down to "h5" being the smallest. |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
... |
Other arguments are parsed as follows:
|
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_label.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
tic_combobox()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_progressbar()
,
tic_radiobutton()
,
tic_separator()
,
tic_sizegrip()
,
tic_slider()
,
tic_spinbox()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
A labelframe widget is a container used to group other widgets together.
tic_labelframe( ..., text, relief, borderwidth, bind = NULL, pack = NULL, pack_def = NULL ) tic_frame(..., relief, borderwidth, bind = NULL, pack = NULL)
tic_labelframe( ..., text, relief, borderwidth, bind = NULL, pack = NULL, pack_def = NULL ) tic_frame(..., relief, borderwidth, bind = NULL, pack = NULL)
... |
Other arguments are parsed as follows:
|
text |
Label to display for this frame. Character string. |
relief |
border style. One of: flat, groove, raised, ridge, solid sunken. Defaults to: 'flat' |
borderwidth |
desired width of widget border |
bind |
bind commands to particular events on this element. This may be
a single result of |
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_def |
Default packing options for children of this object. This
can be overriden by setting |
It has a label.
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_labelframe.htm
Other widgets containers:
tic_window()
Other widgets containers:
tic_window()
A notebook widget manages a collection of windows and displays a single one at a time.
tic_notebook(..., labels, bind = NULL, pack = NULL)
tic_notebook(..., labels, bind = NULL, pack = NULL)
... |
Other arguments are parsed as follows:
|
labels |
Labels to display at the top of each tab. Required. |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
Each content window is associated with a tab, which the user may select to change the currently-displayed window.
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_notebook.htm
A ttk::panedwindow widget displays a number of subwindows, stacked either vertically or horizontally. The user may adjust the relative sizes of the subwindows by dragging the sash between panes.
tic_panedwindow(..., sizes = NULL, orient, bind = NULL, pack = NULL)
tic_panedwindow(..., sizes = NULL, orient, bind = NULL, pack = NULL)
... |
Other arguments are parsed as follows:
|
sizes |
The relative sizes of the elements in this row or column |
orient |
orientataion. 'horizontal' or 'vertical' (default) |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_panedwindow.htm
A progressbar widget shows the status of a long-running operation.
tic_progressbar(variable, mode, maximum, bind = NULL, pack = NULL, ...)
tic_progressbar(variable, mode, maximum, bind = NULL, pack = NULL, ...)
variable |
reactive variable holding the progress value |
mode |
'determinate' or 'indeterminate'. |
maximum |
maximum value when in 'determinate' mode |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
... |
Other arguments are parsed as follows:
|
They can operate in two modes: determinate mode shows the amount completed relative to the total amount of work to be done, and indeterminate mode provides an animated display to let the user know that something is happening.
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_progressbar.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
tic_combobox()
,
tic_label()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_radiobutton()
,
tic_separator()
,
tic_sizegrip()
,
tic_slider()
,
tic_spinbox()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
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, ... )
tic_radiobutton( text, value, variable, command, textvariable, width, bind = NULL, pack = NULL, ... )
text |
Specifies a text string to be displayed inside the widget.
|
value |
The value to store in the associated |
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.
|
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 |
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 |
... |
Other arguments are parsed as follows:
|
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.
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_radiobutton.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
tic_combobox()
,
tic_label()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_progressbar()
,
tic_separator()
,
tic_sizegrip()
,
tic_slider()
,
tic_spinbox()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
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) )
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) )
This is not a direct analogy for a single tk element
tic_row(..., bind = NULL, pack = NULL, pack_def = NULL) tic_col(..., bind = NULL, pack = NULL, pack_def = NULL)
tic_row(..., bind = NULL, pack = NULL, pack_def = NULL) tic_col(..., bind = NULL, pack = NULL, pack_def = NULL)
... |
Other arguments are parsed as follows:
|
bind |
bind commands to particular events on this element. This may be
a single result of |
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_def |
Default packing options for children of this object. This
can be overriden by setting |
handle on the tcl/tk object
This is not a direct implementation for an existing tk element. It is implemented
as a ttk::frame
element with horizontal or vertical packing by default.
A separator widget displays a horizontal or vertical separator bar.
tic_separator(orient, bind = NULL, pack = list(fill = "x"), ...)
tic_separator(orient, bind = NULL, pack = list(fill = "x"), ...)
orient |
'horizontal' or 'vertical'. |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
... |
Other arguments are parsed as follows:
|
handle on the tcl/tk object. TODO: better language needed here.
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_separator.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
tic_combobox()
,
tic_label()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_progressbar()
,
tic_radiobutton()
,
tic_sizegrip()
,
tic_slider()
,
tic_spinbox()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
A sizegrip widget (also known as a grow box) allows the user to resize the containing toplevel window by pressing and dragging the grip.
tic_sizegrip(bind = NULL, ...)
tic_sizegrip(bind = NULL, ...)
bind |
bind commands to particular events on this element. This may be
a single result of |
... |
Other arguments are parsed as follows:
|
On Mac OSX, toplevel windows automatically include a built-in size grip by default. Adding a ttk::sizegrip there is harmless, since the built-in grip will just mask the widget.
handle on the tcl/tk object. TODO: better language needed here.
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_sizegrip.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
tic_combobox()
,
tic_label()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_progressbar()
,
tic_radiobutton()
,
tic_separator()
,
tic_slider()
,
tic_spinbox()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
A slider widget is used to control the numeric value of a reactive variable that varies uniformly over some range.
tic_slider( variable, command, from = 0, to = 100, bind = NULL, pack = list(fill = "x"), ... )
tic_slider( variable, command, from = 0, to = 100, bind = NULL, pack = list(fill = "x"), ... )
variable |
reactive variable holding the slider value. |
command |
function to be invoked when slider value changes |
from , to
|
numerical limits of the slider |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
... |
Other arguments are parsed as follows:
|
The widget displays a slider that can be moved along over a trough, with the relative position of the slider over the trough indicating the value of the variable.
Note: In tcl/tk this widget is known as a ttk::scale
widget.
handle on the tcl/tk object. TODO: better language needed here.
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_scale.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
tic_combobox()
,
tic_label()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_progressbar()
,
tic_radiobutton()
,
tic_separator()
,
tic_sizegrip()
,
tic_spinbox()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
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, ... )
tic_spinbox( values, textvariable, command, from, to, increment, width, bind = NULL, pack = NULL, ... )
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 |
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 |
... |
Other arguments are parsed as follows:
|
The widget implements all the features of the tic_entry()
widget.
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_spinbox.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
tic_combobox()
,
tic_label()
,
tic_menubutton()
,
tic_menuitem()
,
tic_menu()
,
tic_progressbar()
,
tic_radiobutton()
,
tic_separator()
,
tic_sizegrip()
,
tic_slider()
,
tic_submenu()
,
tic_textbox()
,
tic_textentry()
opts <- c('alpha', 'bravo', 'charlie') selected <- reactive_chr(opts[1]) tic_window( title = "Demo", tic_spinbox(values = opts, textvariable = selected) )
opts <- c('alpha', 'bravo', 'charlie') selected <- reactive_chr(opts[1]) tic_window( title = "Demo", tic_spinbox(values = opts, textvariable = selected) )
Note: The interface to this widget differs from the core tcl/tk widget in that
tic_textbox(variable, bind = NULL, pack = NULL, ...)
tic_textbox(variable, bind = NULL, pack = NULL, ...)
variable |
reactive variable which reads the contents of the textbox.
This must be a |
bind |
bind commands to particular events on this element. This may be
a single result of |
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 |
... |
Other arguments are parsed as follows:
|
handle on the tcl/tk object. TODO: better language needed here.
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/text.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
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_textentry()
A textentry widget displays a one-line text string and allows that string to be edited by the user.
tic_textentry( textvariable, validate, validatecommand, width, bind = NULL, pack = NULL, ... )
tic_textentry( textvariable, validate, validatecommand, width, bind = NULL, pack = NULL, ... )
textvariable |
Reactive value for the value displayed in this widget |
validate |
when to vdlidate the contents of this text box. Possible
values: none, key, focus, focusin, focusout, all. If this is not
set then the |
validatecommand |
function to call when validation event occurs. This function must return a non-NA boolean value. |
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 |
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 |
... |
Other arguments are parsed as follows:
|
The value of the string is linked to a reacive variaable with the textvariable
argument.
Note: in tcl/tk this object is known as entry
widget, rather than
textentry
.
handle on the tcl/tk object
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_entry.htm
Other widgets:
tic_button()
,
tic_canvas()
,
tic_checkbutton()
,
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()
Create the top level window
tic_window( ..., title = "{tickle}", width = NULL, height = NULL, idle_func = NULL, idle_fps = 30, bind = NULL, pack = NULL, pack_def = NULL )
tic_window( ..., title = "{tickle}", width = NULL, height = NULL, idle_func = NULL, idle_fps = 30, bind = NULL, pack = NULL, pack_def = NULL )
... |
Other arguments are parsed as follows:
|
title |
Window Title |
width , height
|
width and height of window. If not given then UI will be automatically sized. |
idle_func |
callback function which will be run continually while this window is open. |
idle_fps |
the frame rate at which this idle functino should be called. Default: 30. Set to 'NA' for running as fast as possible. |
bind |
bind commands to particular events on this element. This may be
a single result of |
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_def |
Default packing options for children of this object. This
can be overriden by setting |
the tcl/tk window handle
See tcl/tk documentation for more information on this element https://www.tcl.tk/man/tcl8.6/TkCmd/toplevel.html
Other widgets containers:
tic_labelframe()