[Rd] tcltk GUIs (was need gui matrix editor: does R Core team have advice on how?)

Duncan Murdoch murdoch.duncan at gmail.com
Mon Jan 30 16:13:15 CET 2012


On 30/01/2012 9:17 AM, Kevin R. Coombes wrote:
>
> On 1/29/2012 4:35 PM, Paul Johnson wrote:
> >  On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley
> >  <ripley at stats.ox.ac.uk>   wrote:
> >>  On 28/01/2012 22:04, John Fox wrote:
> >>>  Dear Paul and Gabor,
> >>>
> >>>  The Rcmdr GUI uses the tcltk package, so I have some experience with
> >>>  providing an R tcltk-based GUI for various platforms.
> >>>
> >>>  As Gabor says, everything works very smoothly on Windows because the R
> >>>  Windows binary includes Tcl/Tk.
> >>
> >>  Maybe, but getting it there was very far from smooth.  Tcl/Tk compiled under
> >>  the compilers we used, but the resulting DLLs crashed R.  No one has ever
> >>  found the cause and I used the system SDK (essentiallly a version of VC++)
> >>  to build them.  And that puts us in a bind since the current system SDKs
> >>  generate code depending on DLLs that are not part of the minimal OS versions
> >>  we support (e.g. Windows XP and Server 2003, and the machine used to build
> >>  was retired 2 years ago).
> >>
> >  Thanks, this is clearing things up. I believe these comments mean
> >  that, at the current time, tcl/tk is as close as there is to an
> >  officially endorsed graphical toolkit.  As I search more, I find many
> >  other community contributors (besides Prof. Fox) using tcl/tk
> >  (Sciviews).  So I should learn how to work with that.  Prof Ripley's
> >  comment makes me think the endorsement is not entirely enthusiastic,
> >  though.
> There's this famous quotation from Winston Churchill: "it has been said
> that democracy is the worst form of government except all those other
> forms that have been tried."
>
> Using Tcl/Tk in R is similar.  It's there, and the R Core team (mostly)
> makes sure it works cross-platform, so it is the obvious choice for GUI
> development in R.  But it is far from perfect.  For one thing, the
> documentation in R is quite limited.  The manual pages list all of the
> functions in the tcltk package, but they basically take "..." as their
> arguments.  As a result, you sometimes have to guess how to get the
> inputs formatted correctly to pass them back-and-forth between the R
> process and the Tcl/Tk process (which have very different syntax).  For
> another thing, communication between the two processes (at least on
> Windows) sometimes breaks down in non-reproducible and hard-to-debug
> ways.  We built a tcltk GUI that uses a tabbed notebook interface, which
> is supposed to display five tabs.  Most of the time, it does.  But it
> can end up displaying anything from 1 to 5 tabs.  It always displays
> them in order, so it apparently runs into a problem at some random point
> and stops.  Closing the GUi and restarting it usually fixes the
> problem.  Since we cannot trigger it reproducibly, we have never found
> the underlying source of the problem.
>
> This message is not meant to dissuade you from using Tcl/Tk.  It's just
> a warning to expect some bumps along the way....

Just one addition:  the full Tcl/Tk documentation should be available to 
most users.  It is included in the Windows distribution (and referenced 
from the ?tcltk help page) and I would guess other platforms install it 
when they install Tcl/Tk.  It is written assuming that you're writing in 
Tcl rather than R, but once you work out the translation, it's actually 
somewhat usable.

Duncan Murdoch



More information about the R-devel mailing list