Tcl/Tk Interface

Tcl/Tk Interface [R logo]

Help pages for package `tcltk' version 2.4.1

A I L N P T misc

-- --

tcltk-package Tcl/Tk Interface

-- --

$.tclArray | Low-level Tcl/Tk Interface
.Tcl | Low-level Tcl/Tk Interface
.Tcl.args.objv | Low-level Tcl/Tk Interface
.Tcl.callback | Low-level Tcl/Tk Interface
.Tcl.objv | Low-level Tcl/Tk Interface
.Tk.ID | Low-level Tcl/Tk Interface
.Tk.newwin | Low-level Tcl/Tk Interface
.Tk.subwin | Low-level Tcl/Tk Interface
.TkRoot | Low-level Tcl/Tk Interface

-- A --

addTclPath | Low-level Tcl/Tk Interface
as.character.tclObj | Low-level Tcl/Tk Interface
as.character.tclVar | Low-level Tcl/Tk Interface
as.double.tclObj | Low-level Tcl/Tk Interface
as.integer.tclObj | Low-level Tcl/Tk Interface
as.tclObj | Low-level Tcl/Tk Interface

-- I --

is.tclObj | Low-level Tcl/Tk Interface
is.tkwin | Low-level Tcl/Tk Interface

-- L --

length.tclArray Low-level Tcl/Tk Interface

-- N --

names.tclArray Low-level Tcl/Tk Interface

-- P --

print.tclObj Low-level Tcl/Tk Interface

-- T --

tcl | Tk non-widget commands
tclArray | Low-level Tcl/Tk Interface
tclclose | Tk non-widget commands
tclfile.dir | Tk non-widget commands
tclfile.tail | Tk non-widget commands
TclInterface | Low-level Tcl/Tk Interface
tclObj | Low-level Tcl/Tk Interface
tclopen | Tk non-widget commands
tclputs | Tk non-widget commands
tclread | Tk non-widget commands
tclRequire | Low-level Tcl/Tk Interface
tclServiceMode | Allow Tcl events to be serviced or not
tcltk | Tcl/Tk Interface
tclvalue | Low-level Tcl/Tk Interface
tclVar | Low-level Tcl/Tk Interface
tclvar | Low-level Tcl/Tk Interface
tkactivate | Tk widget commands
tkadd | Tk widget commands
tkaddtag | Tk widget commands
tkbbox | Tk widget commands
tkbell | Tk non-widget commands
tkbind | Tk non-widget commands
tkbindtags | Tk non-widget commands
tkbutton | Tk widgets
tkcanvas | Tk widgets
tkcanvasx | Tk widget commands
tkcanvasy | Tk widget commands
tkcget | Tk widget commands
tkcheckbutton | Tk widgets
tkchooseDirectory | Tk non-widget commands
tkclipboard.append | Tk non-widget commands
tkclipboard.clear | Tk non-widget commands
TkCommands | Tk non-widget commands
tkcompare | Tk widget commands
tkconfigure | Tk widget commands
tkcoords | Tk widget commands
tkcreate | Tk widget commands
tkcurselection | Tk widget commands
tkdchars | Tk widget commands
tkdebug | Tk widget commands
tkdelete | Tk widget commands
tkdelta | Tk widget commands
tkdeselect | Tk widget commands
tkdestroy | Low-level Tcl/Tk Interface
tkdialog | Tk non-widget commands
tkdlineinfo | Tk widget commands
tkdtag | Tk widget commands
tkdump | Tk widget commands
tkentry | Tk widgets
tkentrycget | Tk widget commands
tkentryconfigure | Tk widget commands
tkevent.add | Tk non-widget commands
tkevent.delete | Tk non-widget commands
tkevent.generate | Tk non-widget commands
tkevent.info | Tk non-widget commands
tkfind | Tk widget commands
tkflash | Tk widget commands
tkfocus | Tk non-widget commands
tkfont.actual | Tk non-widget commands
tkfont.configure | Tk non-widget commands
tkfont.create | Tk non-widget commands
tkfont.delete | Tk non-widget commands
tkfont.families | Tk non-widget commands
tkfont.measure | Tk non-widget commands
tkfont.metrics | Tk non-widget commands
tkfont.names | Tk non-widget commands
tkfraction | Tk widget commands
tkframe | Tk widgets
tkget | Tk widget commands
tkgetOpenFile | Tk non-widget commands
tkgetSaveFile | Tk non-widget commands
tkgettags | Tk widget commands
tkgrab | Tk non-widget commands
tkgrid | Tk non-widget commands
tkicursor | Tk widget commands
tkidentify | Tk widget commands
tkimage.cget | Tk non-widget commands
tkimage.configure | Tk non-widget commands
tkimage.create | Tk non-widget commands
tkimage.names | Tk non-widget commands
tkindex | Tk widget commands
tkinsert | Tk widget commands
tkinvoke | Tk widget commands
tkitembind | Tk widget commands
tkitemcget | Tk widget commands
tkitemconfigure | Tk widget commands
tkitemfocus | Tk widget commands
tkitemlower | Tk widget commands
tkitemraise | Tk widget commands
tkitemscale | Tk widget commands
tklabel | Tk widgets
tklistbox | Tk widgets
tklower | Tk non-widget commands
tkmark.gravity | Tk widget commands
tkmark.names | Tk widget commands
tkmark.next | Tk widget commands
tkmark.previous | Tk widget commands
tkmark.set | Tk widget commands
tkmark.unset | Tk widget commands
tkmenu | Tk widgets
tkmenubutton | Tk widgets
tkmessage | Tk widgets
tkmessageBox | Tk non-widget commands
tkmove | Tk widget commands
tknearest | Tk widget commands
tkpack | Tk non-widget commands
tkpager | Page file using Tk text widget
tkplace | Tk non-widget commands
tkpopup | Tk non-widget commands
tkpost | Tk widget commands
tkpostcascade | Tk widget commands
tkpostscript | Tk widget commands
tkradiobutton | Tk widgets
tkraise | Tk non-widget commands
tkscale | Tk widgets
tkscan.dragto | Tk widget commands
tkscan.mark | Tk widget commands
tkscrollbar | Tk widgets
tksearch | Tk widget commands
tksee | Tk widget commands
tkselect | Tk widget commands
tkselection.adjust | Tk widget commands
tkselection.anchor | Tk widget commands
tkselection.clear | Tk widget commands
tkselection.from | Tk widget commands
tkselection.includes | Tk widget commands
tkselection.present | Tk widget commands
tkselection.range | Tk widget commands
tkselection.set | Tk widget commands
tkselection.to | Tk widget commands
tkset | Tk widget commands
tksize | Tk widget commands
tkStartGUI | Tcl/Tk GUI startup
tktag.add | Tk widget commands
tktag.bind | Tk widget commands
tktag.cget | Tk widget commands
tktag.configure | Tk widget commands
tktag.delete | Tk widget commands
tktag.lower | Tk widget commands
tktag.names | Tk widget commands
tktag.nextrange | Tk widget commands
tktag.prevrange | Tk widget commands
tktag.raise | Tk widget commands
tktag.ranges | Tk widget commands
tktag.remove | Tk widget commands
tktext | Tk widgets
tktitle | Tk non-widget commands
tktoggle | Tk widget commands
tktoplevel | Tk widgets
tktype | Tk widget commands
tkunpost | Tk widget commands
tkwait.variable | Tk non-widget commands
tkwait.visibility | Tk non-widget commands
tkwait.window | Tk non-widget commands
tkwidget | Tk widgets
TkWidgetcmds | Tk widget commands
TkWidgets | Tk widgets
tkwindow.cget | Tk widget commands
tkwindow.configure | Tk widget commands
tkwindow.create | Tk widget commands
tkwindow.names | Tk widget commands
tkwinfo | Tk non-widget commands
tkwm.aspect | Tk non-widget commands
tkwm.client | Tk non-widget commands
tkwm.colormapwindows | Tk non-widget commands
tkwm.command | Tk non-widget commands
tkwm.deiconify | Tk non-widget commands
tkwm.focusmodel | Tk non-widget commands
tkwm.frame | Tk non-widget commands
tkwm.geometry | Tk non-widget commands
tkwm.grid | Tk non-widget commands
tkwm.group | Tk non-widget commands
tkwm.iconbitmap | Tk non-widget commands
tkwm.iconify | Tk non-widget commands
tkwm.iconmask | Tk non-widget commands
tkwm.iconname | Tk non-widget commands
tkwm.iconposition | Tk non-widget commands
tkwm.iconwindow | Tk non-widget commands
tkwm.maxsize | Tk non-widget commands
tkwm.minsize | Tk non-widget commands
tkwm.overrideredirect | Tk non-widget commands
tkwm.positionfrom | Tk non-widget commands
tkwm.protocol | Tk non-widget commands
tkwm.resizable | Tk non-widget commands
tkwm.sizefrom | Tk non-widget commands
tkwm.state | Tk non-widget commands
tkwm.title | Tk non-widget commands
tkwm.transient | Tk non-widget commands
tkwm.withdraw | Tk non-widget commands
tkXselection.clear | Tk non-widget commands
tkXselection.get | Tk non-widget commands
tkXselection.handle | Tk non-widget commands
tkXselection.own | Tk non-widget commands
tkxview | Tk widget commands
tkyposition | Tk widget commands
tkyview | Tk widget commands
tk_select.list | Select Items from a List

-- misc --

[[.tclArray Low-level Tcl/Tk Interface


Low-level Tcl/Tk Interface

Description

These functions and variables provide the basic glue between R and the Tcl interpreter and Tk GUI toolkit. Tk windows may be represented via R objects. Tcl variables can be accessed via objects of class tclVar and the C level interface to Tcl objects is accessed via objects of class tclObj.

Usage

.Tcl(...)
.Tcl.objv(objv)
.Tcl.args(...)
.Tcl.args.objv(...)
.Tcl.callback(...)
.Tk.ID(win)
.Tk.newwin(ID)
.Tk.subwin(parent)
.TkRoot

tkdestroy(win)
is.tkwin(x)

tclvalue(x)
tclvalue(x) <- value

tclVar(init="")
## S3 method for class 'tclVar':
as.character(x)
## S3 method for class 'tclVar':
tclvalue(x)
## S3 method for class 'tclVar':
tclvalue(x) <- value

tclArray()
## S3 method for class 'tclArray':
x[[...]]
## S3 method for class 'tclArray':
x[[...]] <- value
## S3 method for class 'tclArray':
x$i
## S3 method for class 'tclArray':
x$i <- value

## S3 method for class 'tclArray':
names(x)
## S3 method for class 'tclArray':
length(x)

tclObj(x)
tclObj(x) <- value
## S3 method for class 'tclVar':
tclObj(x)
## S3 method for class 'tclVar':
tclObj(x) <- value

as.tclObj(x, drop=FALSE)
is.tclObj(x)

## S3 method for class 'tclObj':
as.character(x)
## S3 method for class 'tclObj':
as.integer(x, ...)
## S3 method for class 'tclObj':
as.double(x, ...)
## S3 method for class 'tclObj':
tclvalue(x)

## Default S3 method:
tclvalue(x)
## Default S3 method:
tclvalue(x) <- value

addTclPath(path = ".")
tclRequire(package, warn = TRUE)

Arguments

objv | a named vector of Tcl objects
win | a window structure
x | an object
i | character or (unquoted) name
drop | logical. Indicates whether a single-element vector should be made into a simple Tcl object or a list of length one
value | For tclvalue assignments, a character string. For tclObj assignments, an object of class tclObj
ID | a window ID
parent | a window which becomes the parent of the resulting window
path | path to a directory containing Tcl packages
package | a Tcl package name
warn | logical. Warn if not found?
... | Additional arguments. See below.
init | initialization value

Details

Many of these functions are not intended for general use but are used internally by the commands that create and manipulate Tk widgets and Tcl objects. At the lowest level .Tcl sends a command as a text string to the Tcl interpreter and returns the result as an object of class tclObj (see below). A newer variant .Tcl.objv accepts arguments in the form of a named list of tclObj objects.

.Tcl.args converts an R argument list of tag=value pairs to the Tcl -option value style, thus enabling a simple translation between the two languages. To send a value with no preceding option flag to Tcl, just use an untagged argument. In the rare case one needs an option with no subsequent value tag=NULL can be used. Most values are just converted to character mode and inserted in the command string, but window objects are passed using their ID string, and callbacks are passed via the result of .Tcl.callback. Tags are converted to option flags simply by prepending a -

.Tcl.args.objv serves a similar purpose as .Tcl.args but produces a list of tclObj objects suitable for passing to .Tcl.objv. The names of the list are converted to Tcl option style internally by .Tcl.objv.

Callbacks can be either atomic callbacks handled by .Tcl.callback or expressions. An expression is treated as a list of atomic callbacks, with the following exceptions: if an element is a name, it is first evaluated in the callers frame, and likewise if it is an explicit function definition; the break expression is translated directly to the Tcl counterpart. .Tcl.callback converts R functions and unevaluated calls to Tcl command strings. The argument must be either a function closure or an object of mode "call" followed by an environment. The return value in the first case is of the form R_call 0x408b94d4 in which the hexadecimal number is the memory address of the function. In the second case it will be of the form R_call_lang 0x8a95904 0x819bfd0. For expressions, a sequence of similar items is generated, separated by semicolons. .Tcl.args takes special precautions to ensure that functions or calls will continue to exist at the specified address by assigning the callback into the relevant window environment (see below).

Tk windows are represented as objects of class tkwin which are lists containing a ID field and an env field which is an R environments, enclosed in the global environment. The value of the ID field is identical to the Tk window name. The env environment contains a parent variable and a num.subwin variable. If the window obtains subwindows and callbacks, they are added as variables to the environment. .TkRoot is the top window with ID "."; this window is not displayed in order to avoid ill effects of closing it via window manager controls. The parent variable is undefined for .TkRoot.

.Tk.ID extracts the ID of a window, .Tk.newwin creates a new window environment with a given ID and .Tk.subwin creates a new window which is a subwindow of a given parent window.

tkdestroy destroys a window and also removes the reference to a window from its parent.

is.tkwin can be used to test whether a given object is a window environment.

tclVar creates a new Tcl variable and initializes it to init. An R object of class tclVar is created to represent it. Using as.character on the object returns the Tcl variable name. Accessing the Tcl variable from R is done using the tclvalue function, which can also occur on the left sie of assignments. If tclvalue is passed an argument which is not a tclVar object, then it will assume that it is a character string explicitly naming global Tcl variable. Tcl variables created by tclVar are uniquely named and automatically unset by the garbage collector when the representing object is no longer in use.

tclArray creates a new Tcl array and initalizes it to the empty array. An R object of class tclArray and inheriting from class tclVar is created to represent it. You can access elements of the Tcl array using indexing with [[ or $, which also allow replacement forms. Notice that Tcl arrays are associative by nature and hence unordered; indexing with a numeric index i refers to the element with the name as.character(i). Multiple indices are pasted together separated by commas to form a single name. You can query the length and the set of names in an array using methods for length and names, respectively; these cannot meaningfully be set so assignment forms exist only to print an error message.

It is possible to access Tcl's ‘dual-ported’ objects directly, thus avoiding parsing and deparsing of their string representation. This works by using objects of class tclObj. The string representation of such objects can be extracted (but not set) using tclvalue and conversion to vectors of mode "character", "double", or "integer". Conversely, such vectors can be converted using as.tclObj. There is an ambiguity as to what should happen for length one vectors, controlled by the drop argument; there are cases where the distiction matters to Tcl, although mostly it treats them equivalently. Notice that tclvalue and as.character differ on an object whose string representation has embedded spaces, the former is sometimes to be preferred, in particular when applied to the result of tclread, tkgetOpenFile, and similar functions.

The object behind a tclVar object is extracted using tclObj(x) which also allows an assignment form, in which the right hand side of the assignment is automatically converted using as.tclObj. There is a print method for tclObj objects; it prints <Tcl> followed by the string representation of the object. Notice that as.character on a tclVar object is the name of the corresponding Tcl variable and not the value.

Tcl packages can be loaded with tclRequire; it may be necessary to add the directory where they are found to the Tcl search path with addTclPath.

Note

Strings containing unbalanced braces are currently not handled well in many circumstances.

See Also

TkWidgets, TkCommands, TkWidgetcmds.

capabilities("tcltk") to see if Tcl/Tk support was compiled into this build of R. (It is possible to build with Tcl/Tk support but not be able to run it, if the DLLs are not available or TCL_LIBRARY is not set.)

Examples

## Not run:
## These cannot be run by example() but should be OK when pasted
## into an interactive R session with the tcltk package loaded
.Tcl("format \"%s\n\" \"Hello, World!\"")
f <- function()cat("HI!\n")
.Tcl.callback(f)
.Tcl.args(text="Push!", command=f) # NB: Different address

xyzzy <- tclVar(7913)
tclvalue(xyzzy)
tclvalue(xyzzy) <- "foo"
as.character(xyzzy)
tcl("set", as.character(xyzzy))

top <- tktoplevel() # a Tk widget, see Tk-widgets
ls(envir=top$env, all=TRUE)
ls(envir=.TkRoot$env, all=TRUE)# .Tcl.args put a callback ref in here
## End(Not run)
[Package tcltk version 2.4.1 Index]


Allow Tcl events to be serviced or not

Description

This function controls or reports on the Tcl service mode, i.e. whether Tcl will respond to events.

Usage

tclServiceMode(on = NULL)

Arguments

on (logical) Whether event servicing is turned on.

Details

If called with on == NULL (the default), no change is made.

Value

The value of the Tcl service mode before the call.

Examples

## Not run:

    oldmode <- tclServiceMode(FALSE)
    # Do some work to create a nice picture.  Nothing will be displayed until...
    tclServiceMode(oldmode)
## End(Not run)


Defunct Functions in Package tcltk

Description

The functions or variables listed here are no longer part of R as they are not needed (any more).

Usage

tkcmd(...)

tkfile.tail(...)
tkfile.dir(...)
tkopen(...)
tkclose(...)
tkputs(...)
tkread(...)

Arguments

... Handled via .Tcl.args

Details

As from R 2.0.0, tkcmd has been renamed to tcl. The file commands used to be tkopen, tkclose, etc., but since open and close do not belong to the Tk toolkit, the preferred names are now tclopen, etc.

The $ methods for class "tclvar" have been deprecated in favour of tclVar and tclvalue.

See Also

Defunct


Tcl/Tk Interface

Description

Interface and language bindings to Tcl/Tk GUI elements.

Details

This package provides access to the platform-independent Tcl scripting language and Tk GUI elements. See TkWidgets for a list of supported widgets, TkWidgetcmds for commands to work with them, and references in those files for more.

The Tcl/Tk documentation is in directory R_HOME/Tcl/doc in Windows help format.

For a complete list of functions, use ls("package:tcltk").

Author(s)

R Development Core Team

Maintainer: R Core Team R-core@r-project.org


Select Items from a List

Description

Select item(s) from a character vector using a Tk listbox.

Usage

tk_select.list(list, preselect = NULL, multiple = FALSE, title = NULL)

Arguments

list | character. A list of items.
preselect | a character vector, or NULL. If non-null and if the string(s) appear in the list, the item(s) are selected initially.
multiple | logical: can more than one item be selected?
title | optional character string for window title.

Details

This is a version of select.list implemented as a Tk list box plus OK and Cancel buttons. There will be a scrollbar if the list is too long to fit comfortably on the screen.

The dialog box is modal, so a selection must be made or cancelled before the R session can proceed.

Value

A character vector of selected items. If multiple is false and no item was selected (or Cancel was used), "" is returned. If multiple is true and no item was selected (or Cancel was used) then a character vector of length 0 is returned.

See Also

select.list (a text version except on Windows), menu (whose graphics=TRUE mode uses this on most Unix-alikes.


Tk non-widget commands

Description

These functions interface to Tk non-widget commands, such as the window manager interface commands and the geometry managers.

Usage

tcl(...)
tktitle(x)

tktitle(x) <- value

tkbell(...)
tkbind(...)
tkbindtags(...)
tkfocus(...)
tklower(...)
tkraise(...)

tkclipboard.append(...)
tkclipboard.clear(...)

tkevent.add(...)
tkevent.delete(...)
tkevent.generate(...)
tkevent.info(...)

tkfont.actual(...)
tkfont.configure(...)
tkfont.create(...)
tkfont.delete(...)
tkfont.families(...)
tkfont.measure(...)
tkfont.metrics(...)
tkfont.names(...)

tkgrab(...)
tkgrab.current(...)
tkgrab.release(...)
tkgrab.set(...)
tkgrab.status(...)

tkimage.cget(...)
tkimage.configure(...)
tkimage.create(...)
tkimage.names(...)

## NB: some widgets also have a selection.clear command, hence the "X".

tkXselection.clear(...)
tkXselection.get(...)
tkXselection.handle(...)
tkXselection.own(...)

tkwait.variable(...)
tkwait.visibility(...)
tkwait.window(...)

## winfo actually has a large number of subcommands, but it's rarely
## used, so use tkwinfo("atom", ...) etc. instead.

tkwinfo(...)

# Window manager interface

tkwm.aspect(...)
tkwm.client(...)
tkwm.colormapwindows(...)
tkwm.command(...)
tkwm.deiconify(...)
tkwm.focusmodel(...)
tkwm.frame(...)
tkwm.geometry(...)
tkwm.grid(...)
tkwm.group(...)
tkwm.iconbitmap(...)
tkwm.iconify(...)
tkwm.iconmask(...)
tkwm.iconname(...)
tkwm.iconposition(...)
tkwm.iconwindow(...)
tkwm.maxsize(...)
tkwm.minsize(...)
tkwm.overrideredirect(...)
tkwm.positionfrom(...)
tkwm.protocol(...)
tkwm.resizable(...)
tkwm.sizefrom(...)
tkwm.state(...)
tkwm.title(...)
tkwm.transient(...)
tkwm.withdraw(...)

### Geometry managers

tkgrid(...)
tkgrid.bbox(...)
tkgrid.columnconfigure(...)
tkgrid.configure(...)
tkgrid.forget(...)
tkgrid.info(...)
tkgrid.location(...)
tkgrid.propagate(...)
tkgrid.rowconfigure(...)
tkgrid.remove(...)
tkgrid.size(...)
tkgrid.slaves(...)

tkpack(...)
tkpack.configure(...)
tkpack.forget(...)
tkpack.info(...)
tkpack.propagate(...)
tkpack.slaves(...)

tkplace(...)
tkplace.configure(...)
tkplace.forget(...)
tkplace.info(...)
tkplace.slaves(...)

## Standard dialogs
tkgetOpenFile(...)
tkgetSaveFile(...)
tkchooseDirectory(...)
tkmessageBox(...)
tkdialog(...)
tkpopup(...)

## File handling functions
tclfile.tail(...)
tclfile.dir(...)
tclopen(...)
tclclose(...)
tclputs(...)
tclread(...)

Arguments

x | A window object
value | For tktitle assignments, a character string.
... | Handled via .Tcl.args

Details

tcl provides a generic interface to calling any Tk or Tcl command by simply running .Tcl.args.objv on the argument list and passing the result to .Tcl.objv. Most of the other commands simply call tcl with a particular first argument and sometimes also a second argument giving the subcommand.

tktitle and its assignment form provides an alternate interface to Tk's wm title

There are far too many of these commands to describe them and their arguments in full. Please refer to the Tcl/Tk documentation for details. With a few exceptions, the pattern is that Tk subcommands like pack configure are converted to function names like tkpack.configure, and Tcl subcommands are like tclfile.dir.

See Also

TclInterface, TkWidgets, TkWidgetcmds

Examples

## 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()
tkpack(l1<-tklabel(tt,text="Heave"), l2<-tklabel(tt,text="Ho"))
tkpack.configure(l1, side="left")

## Try stretching the window and then

tkdestroy(tt)
## End(Not run)


Page file using Tk text widget

Description

This plugs into file.show, showing files in separate windows.

Usage

tkpager(file, header, title, delete.file)

Arguments

file | character vector containing the names of the files to be displayed
header | headers to use for each file
title | common title to use for the window(s). Pasted together with the header to form actual window title.
delete.file | logical. Should file(s) be deleted after display?

Note

The "\b_" string used for underlining is currently quietly removed. The font and background colour are currently hardcoded to Courier and gray90.

See Also

file.show


Tcl/Tk GUI startup

Description

Starts up the Tcl/Tk GUI

Usage

tkStartGUI()

Details

Starts a GUI console implemented via a Tk text widget. This should probably be called at most once per session. Also redefines the file pager (as used by help()) to be the Tk pager.

Note

tkStartGUI() saves its evaluation environment as .GUIenv. This means that the user interface elements can be accessed in order to extend the interface. The three main objects are named Term, Menu, and Toolbar, and the various submenus and callback functions can be seen with ls(envir=.GUIenv).

Author(s)

Peter Dalgaard


Tk widget commands

Description

These functions interface to Tk widget commands.

Usage

tkactivate(widget, ...)
tkadd(widget, ...)
tkaddtag(widget, ...)
tkbbox(widget, ...)
tkcanvasx(widget, ...)
tkcanvasy(widget, ...)
tkcget(widget, ...)
tkcompare(widget, ...)
tkconfigure(widget, ...)
tkcoords(widget, ...)
tkcreate(widget, ...)
tkcurselection(widget,...)
tkdchars(widget, ...)
tkdebug(widget, ...)
tkdelete(widget, ...)
tkdelta(widget, ...)
tkdeselect(widget, ...)
tkdlineinfo(widget, ...)
tkdtag(widget, ...)
tkdump(widget, ...)
tkentrycget(widget, ...)
tkentryconfigure(widget, ...)
tkfind(widget, ...)
tkflash(widget, ...)
tkfraction(widget, ...)
tkget(widget, ...)
tkgettags(widget, ...)
tkicursor(widget, ...)
tkidentify(widget, ...)
tkindex(widget, ...)
tkinsert(widget, ...)
tkinvoke(widget, ...)
tkitembind(widget, ...)
tkitemcget(widget, ...)
tkitemconfigure(widget, ...)
tkitemfocus(widget, ...)
tkitemlower(widget, ...)
tkitemraise(widget, ...)
tkitemscale(widget, ...)
tkmark.gravity(widget, ...)
tkmark.names(widget, ...)
tkmark.next(widget, ...)
tkmark.previous(widget, ...)
tkmark.set(widget, ...)
tkmark.unset(widget, ...)
tkmove(widget, ...)
tknearest(widget, ...)
tkpost(widget, ...)
tkpostcascade(widget, ...)
tkpostscript(widget, ...)
tkscan.mark(widget, ...)
tkscan.dragto(widget, ...)
tksearch(widget, ...)
tksee(widget, ...)
tkselect(widget, ...)
tkselection.adjust(widget, ...)
tkselection.anchor(widget, ...)
tkselection.clear(widget, ...)
tkselection.from(widget, ...)
tkselection.includes(widget, ...)
tkselection.present(widget, ...)
tkselection.range(widget, ...)
tkselection.set(widget, ...)
tkselection.to(widget,...)
tkset(widget, ...)
tksize(widget, ...)
tktoggle(widget, ...)
tktag.add(widget, ...)
tktag.bind(widget, ...)
tktag.cget(widget, ...)
tktag.configure(widget, ...)
tktag.delete(widget, ...)
tktag.lower(widget, ...)
tktag.names(widget, ...)
tktag.nextrange(widget, ...)
tktag.prevrange(widget, ...)
tktag.raise(widget, ...)
tktag.ranges(widget, ...)
tktag.remove(widget, ...)
tktype(widget, ...)
tkunpost(widget, ...)
tkwindow.cget(widget, ...)
tkwindow.configure(widget, ...)
tkwindow.create(widget, ...)
tkwindow.names(widget, ...)
tkxview(widget, ...)
tkxview.moveto(widget, ...)
tkxview.scroll(widget, ...)
tkyposition(widget, ...)
tkyview(widget, ...)
tkyview.moveto(widget, ...)
tkyview.scroll(widget, ...)

Arguments

widget | The widget this applies to
... | Handled via .Tcl.args

Details

There are far too many of these commands to describe them and their arguments in full. Please refer to the Tcl/Tk documentation for details. Except for a few exceptions, the pattern is that Tcl widget commands possibly with subcommands like .a.b selection clear are converted to function names like tkselection.clear and the widget is given as the first argument.

See Also

TclInterface, TkWidgets, TkCommands

Examples

## 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()
tkpack(txt.w <- tktext(tt))
tkinsert(txt.w, "0.0", "plot(1:10)")

# callback function
eval.txt <- function()
   eval(parse(text=tclvalue(tkget(txt.w, "0.0", "end"))))
tkpack(but.w <- tkbutton(tt,text="Submit", command=eval.txt))

## Try pressing the button, edit the text and when finished:

tkdestroy(tt)
## End(Not run)


Tk widgets

Description

Create Tk widgets and associated R objects.

Usage

tkwidget(parent, type, ...)
tkbutton(parent, ...)
tkcanvas(parent, ...)
tkcheckbutton(parent, ...)
tkentry(parent, ...)
tkframe(parent, ...)
tklabel(parent, ...)
tklistbox(parent, ...)
tkmenu(parent, ...)
tkmenubutton(parent, ...)
tkmessage(parent, ...)
tkradiobutton(parent, ...)
tkscale(parent, ...)
tkscrollbar(parent, ...)
tktext(parent, ...)
tktoplevel(parent=.TkRoot, ...)

Arguments

parent | Parent of widget window
type | string describing the type of widget desired
... | handled via .Tcl.args

Details

These functions create Tk widgets. tkwidget creates a widget of a given type, the others simply call tkwidget with the respective type argument.

It is not possible to describe the widgets and their arguments in full. Please refer to the Tcl/Tk documentation.

See Also

TclInterface, TkCommands, TkWidgetcmds

Examples

## 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()
label.widget <- tklabel(tt, text="Hello, World!")
button.widget <- tkbutton(tt, text="Push",
                          command=function()cat("OW!\n"))
tkpack(label.widget, button.widget) # geometry manager
                                    # see Tk-commands

## Push the button and then...

tkdestroy(tt)
## End(Not run)