tk2column | R Documentation |
These commands supplement those available in the tcltk package to ease manipulation of tk2XXX widgets.
tk2column(
widget,
action = c("add", "configure", "delete", "names", "cget", "nearest"),
...
)
tk2list.set(widget, items)
tk2list.insert(widget, index = "end", ...)
tk2list.delete(widget, first, last = first)
tk2list.get(widget, first = 0, last = "end")
tk2list.size(widget)
tk2state.set(widget, state = c("normal", "disabled", "readonly"))
tk2insert.multi(widget, where = "end", items)
tk2notetraverse(nb)
tk2notetab(nb, tab)
tk2notetab.select(nb, tab)
tk2notetab.text(nb)
tk2theme.elements()
tk2theme.list()
tk2theme(theme = NULL)
tk2style(
class,
style,
state = c("default", "active", "disabled", "focus", "!focus", "pressed", "selected",
"background", "readonly", "alternate", "invalid", "hover", "all"),
default = NULL
)
tk2dataList(x)
tk2configList(x)
is.tk()
is.ttk()
widget |
The widget to which these actions apply. |
action |
Which kind of action? |
... |
Further arguments to the action. |
items |
The items to add (either a vector for a single line, or a matrix for more items). |
index |
The 0-based index where to insert items in the list. |
first |
The 0-based first index to consider in the list. |
last |
The 0-based last index to consider in the list, or |
state |
The new state of the widget, or the state to inquiry. |
where |
Where are these item added in the list (by default, at the end). |
nb |
A tk2notebook widget ('tclObj' object). |
tab |
The name (text) of a tab in a notebook. |
theme |
A theme to use (character string). |
class |
The class of the tk2widget (either the Tk class, like |
style |
A character string with the name of the style to retrieve. |
default |
The default value to return in case this style is not found. |
x |
Either a tk2widget object, or a character string with its class name. |
tk2column()
manipulate columns of a tk2mclistbox widget,
tk2insert.multi()
is used to insert multiple field entries in a
tk2mclistbox widget,
is.tk()
determines if the tk package is loaded (on some platforms it is
possible to load the tcltk package without tk, for instance, in batch mode).
is.ttk()
determines if 'ttk' widgets (styled widgets) used by the
tk2XXX()
functions are available (you need Tk >= 8.5).
Nothing, these functions are used for their side-effect of changing the state of Tk widgets
In comparison with traditional Tk widgets, ttk proposes an advances mechanism
for styling the widgets with "themes". By default, it adapts to the current
platform (for instance, under Windows, all widgets take the appearance of
Windows themed widgets (even with custom themes applied!). Usual Tk widgets
are ALWAYS displayed in old-looking fashion under Windows. If you want, you
can switch dynamically to a different theme among those available (list them
using tk2theme.list()
, and switch to another one with tk2theme(newtheme)
.
This is most useful to see how your GUI elements and dialog boxes look like
on foreign systems. If you prefer, let's say, a Unix look of the R GUI
elements under Windows, these functions are also useful. If you are more
adventurous, you can even design your own themes (see the tile documentation
on the Tcl wiki).
Philippe Grosjean
tk2button()
, tk2tip()
## Not run:
# These cannot be run by examples() but should be OK when pasted
# into an interactive R session with the tcltk package loaded
tt <- tktoplevel()
# A label with a image and some text
file <- system.file("gui", "SciViews.gif", package = "tcltk2")
# Make this a tk2image function...
Image <- tclVar()
tkimage.create("photo", Image, file = file)
tlabel <- tk2label(tt, image = Image,
text = "A label with an image")
tkpack(tlabel)
config(tlabel, compound = "left")
tlabel2 <- tk2label(tt, text = "A disabled label")
tkpack(tlabel2)
disabled(tlabel2) <- TRUE
fruits <- c("Apple", "Orange", "Banana")
tcombo <- tk2combobox(tt, values = fruits)
tkpack(tcombo)
tkinsert(tcombo, 0, "Apple")
# Buttons
tbut <- tk2button(tt, text = "Enabled")
tbut2 <- tk2button(tt, text = "Disabled")
tkpack(tbut, tbut2)
tkconfigure(tbut2, state = "disabled")
tcheck <- tk2checkbutton(tt, text = "Some checkbox")
tcheck2 <- tk2checkbutton(tt, text = "Disabled checkbox")
tkconfigure(tcheck2, state = "disabled")
tcheck3 <- tk2checkbutton(tt, text = "Disabled and selected")
tkpack(tcheck, tcheck2, tcheck3)
cbValue <- tclVar("1")
tkconfigure(tcheck3, variable = cbValue)
tkconfigure(tcheck3, state = "disabled")
tradio <- tk2radiobutton(tt, text = "Some radiobutton")
tradio2 <- tk2radiobutton(tt, text = "Disabled and checked")
tkpack(tradio, tradio2)
tkconfigure(tradio2, state = "checked")
tkconfigure(tradio2, state = "disabled")
# Menu allowing to change ttk theme
topMenu <- tkmenu(tt) # Create a menu
tkconfigure(tt, menu = topMenu) # Add it to the 'tt' window
themes <- tk2theme.list()
themeMenu <- tkmenu(topMenu, tearoff = FALSE)
if ("alt" %in% themes) tkadd(themeMenu, "command", label = "alt",
command = function() tk2theme("alt"))
if ("aqua" %in% themes) tkadd(themeMenu, "command", label = "aqua",
command = function() tk2theme("aqua"))
if ("clam" %in% themes) tkadd(themeMenu, "command", label = "clam",
command = function() tk2theme("clam"))
tkadd(themeMenu, "command", label = "clearlooks",
command = function() tk2theme("clearlooks"))
if ("classic" %in% themes) tkadd(themeMenu, "command", label = "classic",
command = function() tk2theme("classic"))
if ("default" %in% themes) tkadd(themeMenu, "command", label = "default",
command = function() tk2theme("default"))
tkadd(themeMenu, "command", label = "keramik",
command = function() tk2theme("keramik"))
tkadd(themeMenu, "command", label = "plastik",
command = function() tk2theme("plastik"))
tkadd(themeMenu, "command", label = "radiance (fonts change too)!",
command = function() tk2theme("radiance"))
if ("vista" %in% themes) tkadd(themeMenu, "command", label = "vista",
command = function() tk2theme("vista"))
if ("winnative" %in% themes) tkadd(themeMenu, "command", label = "winnative",
command = function() tk2theme("winnative"))
if ("xpnative" %in% themes) tkadd(themeMenu, "command", label = "xpnative",
command = function() tk2theme("xpnative"))
tkadd(themeMenu, "separator")
tkadd(themeMenu, "command", label = "Quit", command = function() tkdestroy(tt))
tkadd(topMenu, "cascade", label = "Theme", menu = themeMenu)
tkfocus(tt)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.