Thanks everybody for looking at this. I am trying to assign a script to a button please help: ############ library(tcltk) tt<- tktoplevel() tktitle(tt)<-"the title" heading<-tklabel(tt,text="Enter date as YYYY-MM-DD") l1<-tklabel(tt,text="Reporting date") b1=tkbutton(tt,text="Run") d.val<-tkentry(tt,width=12) tkgrid(heading,columnspan=2) tkgrid(l1,d.val) tkgrid(b1,columnspan=2) tkconfigure(b1,command=source("./src/f.imm2.R")) ######### and get inconsistent errors: 1. Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class = "tclObj") : [tcl] invalid command name ".6.4". ## when the tkconfigure is entered from R buffer 2. tkconfigure(b1,command=source("./src/f.imm2.R")) Error in switch(storage.mode(x), character = .External ("RTcl_ObjFromCharVector", : cannot handle object of mode 'list' # when I run the full source buffer (stuff pasted above) the script just needs the date from the tcl window and everything else is conventional R code.
The command argument in the tkconfigure call should be a function, you have the results of sourcing the file, probably not the correct thing. Try something like: tkconfigure(b1,command=function(...){source("./src/f.imm2.R")}) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of stephen bond > Sent: Monday, March 31, 2008 2:45 PM > To: r-help at r-project.org > Subject: [R] tkconfigure throws an error > > Thanks everybody for looking at this. I am trying to assign a > script to a button please help: > > ############ > library(tcltk) > tt<- tktoplevel() > tktitle(tt)<-"the title" > heading<-tklabel(tt,text="Enter date as YYYY-MM-DD") > l1<-tklabel(tt,text="Reporting date") > b1=tkbutton(tt,text="Run") > d.val<-tkentry(tt,width=12) > tkgrid(heading,columnspan=2) > tkgrid(l1,d.val) > tkgrid(b1,columnspan=2) > tkconfigure(b1,command=source("./src/f.imm2.R")) > ######### > and get inconsistent errors: > 1. Error in structure(.External("dotTclObjv", objv, PACKAGE = > "tcltk"), class = "tclObj") : > [tcl] invalid command name ".6.4". ## when the > tkconfigure is entered from R buffer 2. > tkconfigure(b1,command=source("./src/f.imm2.R")) > Error in switch(storage.mode(x), character = .External > ("RTcl_ObjFromCharVector", : > cannot handle object of mode 'list' # when I run the > full source buffer (stuff pasted above) > > the script just needs the date from the tcl window and > everything else is conventional R code. > > ______________________________________________ > R-help at 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. >
When I do it with a function I lose the workspace. This is on a regulated matter and I MUST keep record of all commands/output from the source script plus the resulting workspace. Thanks everybody. ----Original Message---- From: Greg.Snow at imail.org Date: 03/31/2008 13:10 To: "stephen bond"<stenka1 at go.com>, <r-help at r-project.org> Subj: RE: [R] tkconfigure throws an error The command argument in the tkconfigure call should be a function, you have the results of sourcing the file, probably not the correct thing. Try something like: tkconfigure(b1,command=function(...){source("./src/f.imm2.R")}) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of stephen bond > Sent: Monday, March 31, 2008 2:45 PM > To: r-help at r-project.org > Subject: [R] tkconfigure throws an error > > Thanks everybody for looking at this. I am trying to assign a > script to a button please help: > > ############ > library(tcltk) > tt<- tktoplevel() > tktitle(tt)<-"the title" > heading<-tklabel(tt,text="Enter date as YYYY-MM-DD") > l1<-tklabel(tt,text="Reporting date") > b1=tkbutton(tt,text="Run") > d.val<-tkentry(tt,width=12) > tkgrid(heading,columnspan=2) > tkgrid(l1,d.val) > tkgrid(b1,columnspan=2) > tkconfigure(b1,command=source("./src/f.imm2.R")) > ######### > and get inconsistent errors: > 1. Error in structure(.External("dotTclObjv", objv, PACKAGE = > "tcltk"), class = "tclObj") : > [tcl] invalid command name ".6.4". ## when the > tkconfigure is entered from R buffer 2. > tkconfigure(b1,command=source("./src/f.imm2.R")) > Error in switch(storage.mode(x), character = .External > ("RTcl_ObjFromCharVector", : > cannot handle object of mode 'list' # when I run the > full source buffer (stuff pasted above) > > the script just needs the date from the tcl window and > everything else is conventional R code. > > ______________________________________________ > R-help at 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. >