[R-gui] Request for users of my R-Tcl/Tk examples,

Alberto Monteiro albmont at centroin.com.br
Fri Feb 29 12:05:59 CET 2008


Indra B. Kshattry wrote:
>
> I am trying to use R-Tcl/TK in my R-code. I want to develop a dialog 
> box for Data Entry. I am trying to make use of
> 
> Keyword "entry" in your examples, but I could not make it. Could you
> kindly give me a hint to write the code
> 
Do you mean something like this? I am a newbie with R's tcltk too.

library(tcltk)

tt <- tktoplevel() 
input.widget <- tkentry(tt)
output.widget <- tkentry(tt)
tkinsert(input.widget, "end", "4")
tkinsert(output.widget, "end", "24")

gui.fat <- function() {
  n <- as.integer(tclvalue(tkget(input.widget)))
  fat.n <- prod(1:n)
  tkdelete(output.widget, 0, "end")
  tkinsert(output.widget, "end", fat.n)
}

button.widget <- tkbutton(tt, text="fat() =", command = gui.fat) 
tkpack(input.widget, button.widget, output.widget) # geometry manager 
 
Alberto Monteiro



More information about the R-SIG-GUI mailing list