[R] delete variable

solares@unsl.edu.ar solares at unsl.edu.ar
Wed Aug 20 16:58:50 CEST 2003


Why in the codigo that continues when is erased the menubutton herself is 
not erased tambien the variable one opc, though itself deberia you erase 
with the assign?  
library(tcltk)
vectPath<-c()
opc<-tclVar(init=" ")

archivos<-function(){
          f<-tkcmd("tk_getOpenFile")
          temparch<-tclvalue(f)
          assign("vectPath",c(vectPath,temparch),.GlobalEnv)
          cant<-length(vectPath)
          j<-vectPath[cant]         
          tkadd(m, "radio", label=j, variable="opc", value=j)
}

ver<-function(){ 
print(tclvalue("opc"))
}

borra<-function(){
	 assign("vectPath",c(),.GlobalEnv)
	 assign("opc"," ",.GlobalEnv)
     tkdelete(m,"0","end")
}
tt <- tktoplevel()
tkpack(mb <- tkmenubutton(tt, text="Datos"))
m <- tkmenu(mb,tearoff=FALSE) 
tkconfigure(mb,menu=m)
b<-tkbutton(tt,text="abrir",command=function()archivos())
tkpack(b)
b3<-tkbutton(tt,text="ver",command=function()ver())
tkpack(b3)
b4<-tkbutton(tt,text="Borrar",command=function()borra())
tkpack(b4)




More information about the R-help mailing list