Skip to content

R-Tcl/Tk on MacOS X

3 messages · Jan de Leeuw, James Wettenhall

#
Hi,

I have an R-Tcl/Tk application and I do most of my testing on
Windows and Linux, but I am presenting a workshop soon for which
participants will need to install the software on their own
laptops beforehand, and I may get some installation questions
from MacOS X users.  I was just hoping to check on this list
whether the strategy I used to install my R package and its
requirements on MacOS X last year (with R 1.7.0) is still
appropriate for 1.9.x.

My main question is this:  Does the latest R for MacOS X
work better with X11 Tcl/Tk than Aqua Tcl/Tk?  Or, put another
way, is one easier to install than the other?  From memory, X11
was preferred for 1.7.0 (the last R for OS X version I tried).
My R-Tcl/Tk package requires the BWidget and TkTable extensions.
BWidget contains only Tcl scripts (no shared libraries/compiled
code) so it is very easy to install, but TkTable has a compiled
shared library, so it is very important that users know whether
they have an Aqua version (e.g. from TclTkAquaBI) or an X11
version.  I have built an X11 version at:
http://bioinf.wehi.edu.au/limmaGUI/Tktable2.8MacOSX_X11.zip

Best regards,
James
#
The official R-1.9.x for OS X from CRAN or Stefano's
site requires the X11 version of Tcl/Tk. So you have
X11 widgets in your Tcl/Tk windows, while R is running
in R.app. You cannot get Quartz graphics from Terminal.app
or Emacs.app.

My unofficial R-devel on http://gifi.stat.ucla.edu/pub uses
Aqua Tcl/Tk. It uses  a rather nasty hack to provide Quartz
from Terminal.app and Emacs.app. You
cannot use packages such as tkrplot, which depends
explicitly on X11s. It also implies
that if you have a package that loads a
shared library into Tcl/Tk, then that shared library
should be a dynamic library and not a bundle
(that's the way Aqua Tcl/Tk is set up). It does not
work well with R running in R.app.

So, on balance, I think you should go with the
official X11 version and live with the ugliness
until R-core fixes the eventloop problem.
On Jun 29, 2004, at 3:50, James Wettenhall wrote:

            
===
Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
Editor: Journal of Multivariate Analysis, Journal of Statistical  
Software
US mail: 8130 Math Sciences Bldg, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550;  fax (310)-206-5658;  email: deleeuw@stat.ucla.edu
homepage: http://gifi.stat.ucla.edu
   
------------------------------------------------------------------------ 
-------------------------
           No matter where you go, there you are. --- Buckaroo Banzai
                    http://gifi.stat.ucla.edu/sounds/nomatter.au
#
Jan,

Thanks-very much for your reply.  I'll definitely advise 
MacOS X participants in our microarray workshop to use X11 
Tcl/Tk, i.e. I'll tell them NOT TO install the 
Tktable extension from TclTkAquaBI, but to instead INSTALL IT 
FROM http://bioinf.wehi.edu.au/limmaGUI/

My R-Tcl/Tk GUI does use tkrplot quite a lot, so it is limited 
to X11 at the moment, but I will add an option soon, so that the 
user can choose between tkrplot and the regular R graphics 
device for all plots.

One thing I have in my tkrplot windows is a File menu with 
options to save the plot as PNG, JPEG, PDF etc.  Rgui in Windows 
provides this automatically when using the regular R graphics 
device.  On Linux/X11, things are a bit more complicated because 
of the difference between png() and bitmap().  png() should 
work as long as you have a valid DISPLAY for X11, but I 
seem to remember having problems at some stage with my 
R-Tcl/Tk GUI with png() on Linux/X11 so I switched to 
bitmap(), which creates PNGs indirectly via ghostscript, 
so they don't looks as good, but they can be created 
without an X11 DISPLAY.  (But then how could I have 
been running R-Tcl/Tk without a valid X11 DISPLAY???)

I suppose on MacOS X, png() etc. should always work.

I've just asked my administrator to install R 1.9.1 on a Mac, 
so I guess I'll soon find out how this issue (of being able to 
easily save PNGs etc.) compares between tkrplot and the regular 
graphics device for my R-Tcl/Tk GUI running in R 1.9.1 on 
MacOS X.

Regards,
James