Mar 15, 2001 ... Introduction. Tcl/Tk is a combination of a scripting language and ... version of R.
The tcltk package also works on Win- dows. It (currently) does ...
Vol. 1/3, September 2001
27
A Primer on the R-Tcl/Tk Package by Peter Dalgaard
Introduction Tcl/Tk is a combination of a scripting language and a toolkit for graphical user interfaces. Since version 1.1.0, R has had a tcltk package to access the Tk toolkit, replacing Tcl code with R function calls (Dalgaard, 2001). There are still some design problems in it, but it is quite useful already in its current state. This paper intends to get you started with the RTcl/Tk interface. Tcl/Tk is a large package, so it is only possible to explain the basic concepts here. The presentation here is based on the X11/Unix version of R. The tcltk package also works on Windows. It (currently) does not work with Mac OS Classic but it does work with OS X. It is only the Linux variants that come with Tcl/Tk; on other systems some footwork will be necessary to get it installed.
Widgets A widget is a GUI element. Tk comes with a selection of basic widgets: text editing windows, sliders, text entry fields, buttons, labels, menus, listboxes, and a canvas for drawing graphics. These can be combined to form more complex GUI applications. Let us look at a trivial example: library(tcltk) tt