Skip to content
Prev 42376 / 63424 Next

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

On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
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.

If there were a change to emphasize Gtk2, I don't think I would be
disappointed. I've been testing table-making examples today.  On
Debian Linux, I am having more luck with the Gtk2 based packages.
dfedit in RGtk2Extras "just works" for me. Example:
That edits the R object mat as expected.

On the other hand, I don't have success with the tk2edit from tcltk2,
even with the example in the help page:
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Error in matrix("", nrow = nrow(tA), ncol = ncol(tA)) :
  non-numeric matrix extent

I've fiddled with this quite a bit, I believe there's some little
mismatch between this particular system's tcl/tk libraries and the
ones that tcltk2 is expecting. Packaging of tcl/tk has caused lots of
trouble with Swarm simulations that we run, maybe that's breaking
tktable usage too.   I'm going to look into that some more.

I think the idea behind gWidgetstcltk is great, it aims to create R
functions that can use either Gtk2 or tclk.  But the implementation is
a big hassle, it seems to me.  It inherits all of the management
troubles of both tcltk and Gtk2. For example.
Select a GUI toolkit

1: gWidgetsRGtk2
2: gWidgetstcltk

Selection: 2
guiWidget of type: NULL for toolkit: guiWidgetsToolkittcltk
Warning message:
In .gdf(toolkit, items = items, name = name, do.subset = do.subset,  :
  Container is not correct. No NULL containers possible

When I run the example at the end of the help from ?gdf in
gWidgetstcltk, I get this (even before trying to use the table at
all).
Error in `.leftBracket<-`(`*tmp*`, toolkit, ..., value = list(mpg = c(21,  :
  Value has different number of rows than the replacement area

If I make the other selection, opting for Gtk2, I don't get an error,
but nothing happens--no table pops up either.
Select a GUI toolkit

1: gWidgetsRGtk2
2: gWidgetstcltk

Selection: 1
Loading required package: gWidgetsRGtk2
guiWidget of type: gGridRGtk for toolkit: guiWidgetsToolkitRGtk2

If I had not seen the Gtk2 table work well with RGtk2Extras, I'd have
no faith at all.

In conclusion, what am I supposed to work on?

If tcl/tk is likely to stay in the R for Windows package, then we can
work on streamlining the Macintosh and Windows instructions for tcltk
maintenance, then I see my mission now is to make TkTable based
widgets work.   Right?

Something Prof. Grothendieck said made me curious.  One can package
the TkTable library with an R package?  Why is it not already included
in packages like tcltk2 or gWidgetstcltk?

Debian package libtktable2.9 installs these files:

/usr/lib/Tktable2.9/libTktable2.9.so
/usr/lib/Tktable2.9/pkgIndex.tcl
/usr/lib/Tktable2.9/tkTable.tcl

So TkTable requries not just the tcl bit, but a shared library. Is
that a substantial roadblock to R packaging of TkTable? (I've never
tried it).

pj