bastien.preuss at noumea.ird.nc
2008-Oct-22 06:10 UTC
[Rd] Bug when importing datas with tcltk window (PR#13191)
Full_Name: PREUSS Bastien Version: R version 2.6.2 (2008-02-08) OS: mingw32 Submission from: (NULL) (193.51.249.166) Hello, I wrote a small function using tcltk to import my datasets. When I use it, both the tcltk and the R windows closed themselves. I don't understand why. What is surprising is that it doesn?t happen each time. Most of the time I can't finish the importation of my 3 data folders, but sometimes I am successful. Here is my function: require(tcltk) import.donnees.f = function() { #### openObservations.f = function(){ name1<-tclvalue(tkgetOpenFile()) if (!nchar(name1)) tkmessageBox(message="Aucun fichier n'a ?t? s?lectionn?!") else tkmessageBox(message=paste("Vous avez s?lectionn? le fichier ",name1)) assign("fileName",name1,envir=.GlobalEnv) } openUnitobs.f = function(){ name2<-tclvalue(tkgetOpenFile()) if (!nchar(name2)) tkmessageBox(message="Aucun fichier n'a ?t? s?lectionn?!") else tkmessageBox(message=paste("Vous avez s?lectionn? le fichier ",name2)) assign("fileName2",name2,envir=.GlobalEnv) } openListespeces.f = function(){ name3<-tclvalue(tkgetOpenFile()) if (!nchar(name3)) tkmessageBox(message="Aucun fichier n'a ?t? s?lectionn?!") else tkmessageBox(message=paste("Vous avez s?lectionn? le fichier ",name3)) assign("fileName3",name3,envir=.GlobalEnv) } tt <- tktoplevel() tkwm.title(tt,"Import des fichiers de donn?es") button.widget <- tkbutton(tt,text="Table de donn?es d'observations ",command=openObservations.f) button.widget2 <- tkbutton(tt,text="Table de donn?es sur les unit?s d'observation ",command=openUnitobs.f) button.widget3 <- tkbutton(tt,text="Table de donn?es sur les esp?ces ",command=openListespeces.f) OK.but <- tkbutton(tt,text=" Valider ",command=function() tkdestroy(tt)) tkpack(button.widget,button.widget2,button.widget3,OK.but) tkfocus(tt) tkwait.window(tt) }