[R-gui] R tcltk/tcltk2 vs. R GTk2

john verzani jverzani at gmail.com
Fri Aug 3 23:04:10 CEST 2007


Michael Lawrence <lawremi <at> iastate.edu> writes:

> 
> On 8/1/07, Philippe Grosjean <phgrosjean <at> sciviews.org> wrote:
> >
> > Just my 0.02$ added to this discussion: tcl/tk could be automatically
> > installed under Windows (if the option is checked), and tile is readily
> > usable once the tcltk2 package is installed. Also, using tcltk2, you
> > have more Windows look&feel than with Gtk2.
> 
> This is a little debatable.  I've never used tcl/tk on Windows to compare,
> but the GTK+ windows theme engine is fairly mature and constantly improving.
> There are some differences, eg with the file chooser, but in my experience
> this has not caused any trouble. The fact that tcl/tk is included with
> windows is a valid point, yet a simple R script can download GTK+ and
> install it. Most users of my software are non-technical biologists, and they
> have had success with this method.
> 
> There are also a couple of
> > other advantages of tcltk on specific tasks, mainly thanks to nice
> > aspects in the underlying tcl language readily available. So, under
> > Windows, tcltk (+ tcltk2) solution is much more easily in operation on
> > any users computer than a solution based on RGtk2.
> >
> > For Linux, Gtk2 is certainly at home, although there is special tile
> > version in development to support Qt widgets, I think.
> >
> > For MacOS X neither provide the appropriate look&feel. There a special
> > Tcl/Tk distro installed on all MacOS X (at least on Tiger), but the
> > regular R distribution with the AQUA GUI cannot use it. It is possible
> > to compile R to use it and then, you got an excellent tcltk + tcltk2
> > solution with MacOS X look&feel that is almost perfect. However, this is
> > something only for experienced users, while most GUIs target beginners.
> 
> There is a native Mac port of GTK+ based on Aqua that is under active
> development and should be released soon.
> 
> For the rest, I pretty much agree that Gtk2 is much more powerful, but I
> > am not sure we need all its power for 99% of the simple GUIs stuff
> > required on top of R.
> >
> > We should end the widgets war, and start looking at gWidgets by John
> > Vezani, which intend to provide an interface to GUI widgets from R
> > independent from a particular implementation. At the moment, there is
> > only an implementation of gWidgets interface for RGtk2 (and one for
> > Java?),... but an implementation for tcltk (/tcltk2) should not be too
> > difficult to do. I may work on it once I have some time, that certainly
> > not in the near future!!!
> 
> I agree that gWidgets is the way to go for simple to even complex GUIs.
> Besides portability, its API has been designed from the ground up for R.
> John just told me that he has the tcltk port mostly finished.
> 


As Michael points out, I recently posted gWidgetstcltk to CRAN. This allows much
of gWidgets to be used with tcl/tk. I didn't want to rely on any outside tcl/tk
libraries for this. Mostly I was lazy, but I also wanted it to be used without
any fussing by end users. Anyways, if any one tries it out, I would be
interested in comments. There are some things about layout that I obviously
haven't learn well enough yet and other bugs to find.

If the original poster is willing to install some software, this might show a
few differences between the two toolkits:


eg = function() {
  win = gwindow("example")
  g = ggroup(horizontal=FALSE, cont=win)
  gbutton("Look", cont=g)
  glabel("Ma.", cont=g)
  glabel("I", editable=TRUE, cont=g)
  gdroplist(c("just","JUST"), cont=g)
  gradio(c("Made","a"), cont=g)
  gcheckboxgroup(c("G","U","I","."), cont=g)
}

options("guiToolkit"="tcltk")
eg()
options("guiToolkit"="RGtk2")
eg()

(And wouldn't you know it I found a bug in glabel under tcltk with the
editable=TRUE part.)

--John

--- snip ---



More information about the R-SIG-GUI mailing list