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

j verzani jverzani at gmail.com
Mon Jan 30 03:29:53 CET 2012


Paul Johnson <pauljohn32 <at> gmail.com> writes:


.. snip ..



> 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.
> 
> > library(gWidgetstcltk)
> > mat <- matrix(rnorm(100), 10 , 10)
> > gdf(mat)
> 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
> 

Although, this discussion is better suited for the GUIs list,
I'll weigh in a bit on the gWidgets discussion here, but first note
that Tom Taverner spent a lot of time on the the table editor
inRGtk2Extras.  It is by far the most like a spread sheet.


The gdf(mat) call requires a parent container, e.g. gdf(mat,
container=gwindow()). You would also want to save the object so you
can manipulate the edited values.


> 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).
> 
> >    obj[,] <- head(mtcars) ## replace df
> Error in `.leftBracket<-`(`*tmp*`, toolkit, ..., value = list(mpg = c(21,  :
>   Value has different number of rows than the replacement area
> 


The table implementation varies widely among the toolkits. The tcltk
one uses tkTable and I didn't spend a lot of time on this. I just
copied the implementation in tcltk2. As implemented here, this basic
one doesn't let you adjust rows and columns, just edit them.

The in-progress gWidgets2tcltk (on github) avoids the extra library by
creating a row editor. Not the most natural, but it can do more of
this type of thing.


.. snip ..

> In conclusion, what am I supposed to work on?
> 

Well, tcltk is the easiest to install. RGtk2 has the nicest table
editor. Qt isn't ready for windows users, but has the best table
widget of all the three. You also have a nice editor in JGR, which
uses rjava. Your choice, but you haven't mentioned the most universal
of all -- the web browser.

You could leverage R's help server (say with Rook) and create a form
to edit.  You could even use gWidgetsWWW2 and take advantage of Ext's
table editor which isn't bad, though you have to specify the size
ahead of time. (Well even here you have issues. The in-progress
version (again on github) isn't working with IE until Ext
stabilizes...)



More information about the R-devel mailing list