[R] Tcl Tk table

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Apr 23 19:01:49 CEST 2004


thsudler at swissonline.ch writes:

> tkcmd(.Tk.ID(table1),"tag","celltag","gruen",list(c("3,3", "4,4", "5,5", "6,6", "7,7", "8,8")))

Did that ever work? Prior to 1.8.0, a character vector would get
expanded to multiple arguments, but not lists, AFAIR. 

The character vector expansion was sort of a nice feature in some
cases, but it was was inconsistent with the rest of the design where
one argument to tkcmd is one Tcl object (or two, for named arguments)
and there were other cases where you'd want a character vector to be
passed as a Tcl list. Also, the whole mechanism for converting from R
to Tcl commands was horribly inefficient in some cases, and needed
replacement.

If you need to create a Tcl command with a variable number of
arguments, you now need to create an R function call with a variable number
of arguments, i.e. use do.call() as in

do.call("tkcmd", c(list(table1,"tag","cell","gruen"),
                 as.list(paste(3:8,3:8),sep=","))

(note btw that .Tk.ID() is wrong, you can just pass the widget itself) 

In a *really* tight spot, you can still get the old behaviour using
.Tcl(.Tcl.args(.....))

> #But this works also with R 1.9
> tkcmd(.Tk.ID(table1),"tag","celltag","gruen","3,3","4,4","5,5","6,6","7,7","8,8")
> tkcmd(.Tk.ID(table1),"tag","configure","gruen",bg="green",fg="green")

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list