[R-gui] Tcl/Tk examples update
James Wettenhall
wettenhall at wehi.edu.au
Thu Feb 26 07:31:05 MET 2004
Hi,
Last year I put some examples of creating Tk widgets
in R (using Peter Dalgaard's tcltk package) on a webpage:
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/
Since R 1.8.0, it has become possible to interact with the Tktable
widget extension in a new way (through the new tclArray
interface in tcltk), and it has become easier to create Tcl lists
from R vectors (useful in combo-boxes). So I have finally
cleaned up the some of the messy code on that webpage, particularly
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tktable.html
and
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/DropDown.html
Creating a (drop-down) combo box from an R vector is now easy if
you have the BWidget extension:
Rvector <- c("one","two","three")
tt <- tktoplevel()
tclRequire("BWidget")
comboBox <- tkwidget(tt,"ComboBox",values=Rvector)
tkpack(comboBox)
Also I removed a few instances of .Tcl(paste(...)) which is more
prone to "quoting hell" problems than tkcmd(...) and tkwidget(...)
and possibly slower too.
Sorry to people on this list who are already R-Tcl/Tk experts or
who aren't interested.
Feel free to point out errors etc.
Regards,
James
More information about the R-SIG-GUI
mailing list