[EMAIL PROTECTED] wrote:
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)


______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


archOp<-tclVar(init=" ")
............
tkadd(m, "radio", label=arch, variable="archOp", value=arch)
............
You have assigned R variable archOp to tk radio-menu. But in tcl interpreter archOp has different name and you may find it by command ls(envir=archOp) (something like ::RTclxxx). You should pass this name as variable parameter to tkadd(m, "radio", label=arch, variable=ls(envir=archOp), value=arch)


______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to