[R] ttkcombobox

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Mon Oct 27 22:01:51 CET 2008


Hi, all,

(sessionInfo at the end)

I've been struggling with the tcltk package and can't seem to get the 
ttkcombobox to work. Here's an example:

library(tcltk)
p <- tktoplevel()
l <- tclVar()
## I don't know if I'm even calling it correctly
cb <- ttkcombobox(p, values = letters[1:4], textvariable = l)
tkpack(cb)

1. How do I know when the value of the combobox has been changed from, 
say, "a" to "b"?
2. How can I get the value of the box? E.g. if I switch the box to "b", 
how can I access this value?
3. How can I set the default value to something of my choice? I've tried 
the "set" argument as described in the "Tcl/Tk 8.5 Manual" but I 
received an error:
cb <- ttkcombobox(p, values = letters[1:4], textvariable = l, set = "b")
Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), 
class = "tclObj") :
   [tcl] unknown option "-set".

Thanks,

--sundar

 > sessionInfo()
R version 2.7.2 (2008-08-25)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets  methods
[8] base



More information about the R-help mailing list