From kevin.r.coombes at gmail.com  Mon Jan 30 15:17:36 2012
From: kevin.r.coombes at gmail.com (Kevin R. Coombes)
Date: Mon, 30 Jan 2012 08:17:36 -0600
Subject: [Rd] tcltk GUIs (was need gui matrix editor: does R Core team
 have advice on how?)
In-Reply-To: <CAErODj8-CMoQDJOcLTY0F=_-rT0fEkWDZ5Y5JKSGL1HRBq2epA@mail.gmail.com>
References: <CAErODj9ZMXTEbnSD-bRShAuXfXK6nBROFjt4UnadL-SkKFt4NA@mail.gmail.com>
	<CAP01uRk2O9bTDijvxLXRpnXihJFAZe4XS4NcQeN-KHOqhwf8rA@mail.gmail.com>
	<002401ccde08$dc207100$94615300$@mcmaster.ca>
	<4F25372B.8020307@stats.ox.ac.uk>
	<CAErODj8-CMoQDJOcLTY0F=_-rT0fEkWDZ5Y5JKSGL1HRBq2epA@mail.gmail.com>
Message-ID: <4F26A680.10706@gmail.com>



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....

Good luck,
     Kevin



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