vincent guyader
2012-Nov-20 10:25 UTC
[R] tcl/tk problem with tklistbox,the " " character and Rcmdr.
I everyone, i have a little problem with tklistbox,the " " character and Rcmdr. Please look at this code require(tcltk) tt<-tktoplevel() levels.list2 <-tklistbox(tt,selectmode="multiple",exportselection="FALSE", height=4, yscrollcommand=function(...)tkset(levels.list2.scroll,...)) levels.list2.scroll<-tkscrollbar(tt,repeatinterval=5,command=function(...)tkyview(levels.list2,...)) tkgrid(levels.list2,levels.list2.scroll) vec<-c("a","b",""," "," ") tkdelete(levels.list2,"0","end") for (var in vec) {tkinsert(levels.list2, "end", var)} tclvalue(tkget(levels.list2,"0"))# a tclvalue(tkget(levels.list2,"1"))# b tclvalue(tkget(levels.list2,"2"))# "" tclvalue(tkget(levels.list2,"3"))# " " it's ok tclvalue(tkget(levels.list2,"4"))# " " it's ok library(Rcmdr) #same command : tclvalue(tkget(levels.list2,"0"))# a tclvalue(tkget(levels.list2,"1"))# b tclvalue(tkget(levels.list2,"2"))# "" tclvalue(tkget(levels.list2,"3"))# "" instead of " " tclvalue(tkget(levels.list2,"4"))# "" instead of " " it's crazy!? any idea Thank you [[alternative HTML version deleted]]
Yves Reecht
2012-Nov-20 10:47 UTC
[R] tcl/tk problem with tklistbox,the " " character and Rcmdr.
Hi Vincent, This is probably because Rcmdr redefine the tclvalue command (check the message frame of the Rcmdr window). You can try: tcltk::tclvalue(tkget(levels.list2,"4")) HTH, Yves Le 20/11/2012 11:25, vincent guyader a écrit :> I everyone, > > i have a little problem with tklistbox,the " " character and Rcmdr. > > Please look at this code > > require(tcltk) > tt<-tktoplevel() > levels.list2 <-tklistbox(tt,selectmode="multiple",exportselection="FALSE", > height=4, yscrollcommand=function(...)tkset(levels.list2.scroll,...)) > levels.list2.scroll<-tkscrollbar(tt,repeatinterval=5,command=function(...)tkyview(levels.list2,...)) > > tkgrid(levels.list2,levels.list2.scroll) > > vec<-c("a","b",""," "," ") > tkdelete(levels.list2,"0","end") > for (var in vec) {tkinsert(levels.list2, "end", var)} > > > > tclvalue(tkget(levels.list2,"0"))# a > tclvalue(tkget(levels.list2,"1"))# b > tclvalue(tkget(levels.list2,"2"))# "" > tclvalue(tkget(levels.list2,"3"))# " " it's ok > tclvalue(tkget(levels.list2,"4"))# " " it's ok > > > library(Rcmdr) > #same command : > tclvalue(tkget(levels.list2,"0"))# a > tclvalue(tkget(levels.list2,"1"))# b > tclvalue(tkget(levels.list2,"2"))# "" > tclvalue(tkget(levels.list2,"3"))# "" instead of " " > tclvalue(tkget(levels.list2,"4"))# "" instead of " " > > > it's crazy!? > any idea > > Thank you > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]