Dear List, I'm looking for some informations about the function "tkinsert()". I d'like to write lot of command in my text window and after to evaluate it with a button "Submit" for example, but i have some problems:
here a exemple of my code: 1) My first problem tt=tktoplevel() txt=tktext(tt,height=40) tkpack(txt) var1=paste("x=2") tkinsert(txt,"0.0",var1) var2=paste("a=mean(c(1,2,3))") tkinsert(txt,"end",var2) But in my text window I have : x=2a=mean(c(1,2,3)) I d'like to have something like: x=2 a=mean(c(1,2,3)) 2)My second problem, I use the run function that i have found in R TCLTK example Evaluating R Code From A Text Window in R TclTk: run <- function() { code <- tclvalue(tkget(txt,"0.0","end")) e <- try(parse(text=code)) if (inherits(e, "try-error")) { tkmessageBox(message="Syntax error", icon="error") return() } cat("Executing from script window:", "-----", code, "result:", sep="\n") print(eval(e)) } topMenu <- tkmenu(tt) tkconfigure(tt, menu=topMenu) fileMenu <- tkmenu(topMenu, tearoff=FALSE) tkadd(topMenu, "command", label="Run", command=run) But when I run a=mean(c(1,2,3)) I have the result on my R console but i can't access to the result. If i write a, R don't know "a". Thanks a lot, and so sorry for my poor english, i hope you understand my problems... Julie. Cet été, pensez aux cartes postales de laposte.net ! [[alternative HTML version deleted]]
______________________________________________ R-help@stat.math.ethz.ch 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.