[R] Rgui and tcltk
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Oct 26 13:27:37 CEST 2000
> Date: Thu, 26 Oct 2000 11:14:16 +0100
> From: David Firth <david.firth at nuffield.oxford.ac.uk>
> I am having a little problem in relation to sending output to the R
> Console window, when a function is called by pushing a button in a Tk
> window. Actually there seem to be two components to the problem:
> -- the R prompt does not re-appear until <return> is pressed
That's standard with these TclTk things, even on Unix. What's
happening is that the console is still waiting for input, and is
unaware that another part of the event loop has generated a command and
hence output. So you can just type new input, without waiting for the prompt.
> -- text output to the R Console window *disappears* after <return> is
I believe it gets overwritten by the input line. That's an R GUI
console gotcha. You should have more success running from Rterm. We
need to keep track in the GUI console of where the last output was,
rather than where we were looking for input. I've done some work on
this for the next version, but it is probably not right yet.
(The same problem occurs when using Rprintf to debug C code.)
> The following, in R 1.1.1 under Windows NT 4, and using Tcl/Tk 8.3,
> testwindow <- tktoplevel()
> testbutton <- tkbutton(testwindow, text="Click me", command=testaction)
> This successfully makes a Tk window with a button. But pressing the
> button does not do what I intended. What I would like is for the
> button-press to print out "Hello" at the R Console, and return to the
> R prompt. I would welcome any hints on how I am going wrong here.
I don't believe it is you! This is said to be experimental code, and
there are definitely issues about running two GUIs at once we have
to think more about.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help