[R] menubutton don´t work

solares@unsl.edu.ar solares at unsl.edu.ar
Fri Aug 15 16:57:28 CEST 2003


Why the variable  archOp does not take the value that be chosen in the 
menubutton?, therefore always remains as a white one, I intend to charge 
the direccion of open files in a vector and then to elect with the 
menubutton with which to work but not functions thanks.Ruben

library(tcltk)
arch<-tclVar(init=" ")
archOp<-tclVar(init=" ")
vectPath<-c()
archivos<-function(){
 f<-tkcmd("tk_getOpenFile")
 temparch<-tclvalue(f)
 assign("vectPath",c(vectPath,temparch),.GlobalEnv)
 cant<-length(vectPath)
 arch<-vectPath[cant]
 tkconfigure(mb,state="normal")
 tkadd(m, "radio", label=arch, variable="archOp", value=arch)
 tkconfigure(b2,state="normal")
}
ver<-function(n){
 tabla<-read.table(n,header=TRUE,comment.char="@")
 nbre<-names(tabla)
 tabla
}
tt<-tktoplevel()
b<-tkbutton(tt,text="abrir",command=function()archivos())
tkpack(b)

tkpack(mb <- tkmenubutton(tt, text="Datos",state="disabled"))
m <- tkmenu(mb,tearoff=FALSE) 
tkconfigure(mb,menu=m)
b2<-tkbutton(tt,text="Ver",command=function()ver(arch),state="disabled")
tkpack(b2)




More information about the R-help mailing list