need gui matrix editor: does R Core team have advice on how?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

need gui matrix editor: does R Core team have advice on how?

PaulJohnson32gmail
Dear R-devel:

Would R core team consider endorsing a graphical toolkit and trying to
facilitate development of little GUI tools?

I need a gui matrix editor for users that want to be able to write
matrices that are later used to simulate data.  Instead of teaching
them to write a covariance matrix (for example, for mvtnorm), I want
to tell them run a function that pops up a table they can fill in.

The users need to be able to enter variable names in the matrix, so
something that would accept

a  0  0
0  b  0
c  d  e

would be great.  Something that would accept formulae like this would
be even more great.

a  0  0
0  b  a^2
c  d  e

I want this gui matrix editor to "just work" on Windows, Mac, Linux. I
don't mind building this on top of some widget set, but it is
important that the widget set be easily installable on the user end.

That's why I wish R core would offer us some guidance or advice.  I'm
not a programmer, but I can learn to program with a library, as long
as it is not a waste of time.

I've been searching R archives and here's what I found so far.

1. tcl/tk

Building on R tcltk2, for people that have the Tcl addon widget
TkTable installed, there are several packages.  in tcltk2 itself,
there is a function tk2edit, and there are others that try to
embellish.  I've tried several of these, they seem to be not-quite
done yet, one can't copy a rectangle, for example. But maybe I could
learn how to fix them up and make yet another tktable based editor.

Problem: requires user to have enough understanding to install the Tcl
widget TkTable.  And, for platforms like Windows, user has to install
tcl/tk itself.  On Linux and Mac, that is not as big of a hurdle, so
far as I can tell.  On Debian linux, I found that in a package
libtktable that works, but I have no idea how tough that would be on
other linux systems or Macintosh or Windows.

Another problem is that tcl/tk editions change rapidly, and on several
of our systems, we still don't have access to tcl/tk 8.5
(RedHat/Centos based clusters still running version 5 are like that).

2. Gtk

Building on Rgtk, I found the package RGtk2Extras.  This of course
requires a function gtk tool chain, which used to be a big problem on
the various platforms.  But the function dfedit appears to be almost
exactly what I'm looking for.  I can create a character matrix and put
in letters how I want, but I later face the problem of how to evaluate
the matrix.

Problem: even more than tcl/tk, GTK versions change and become
incompatible, especially across platforms.

What about QT or WX-Widgets.  I gather RkWard is built on KDE, and
hence Qt.  I don't find matrix editors using those languages, but I
don't know why not.

Maybe this is impossible for R core to advise us because you may
disagree on which widget library is best, but if there is some
consensus, I would be glad to know because I would do whatever you
recommend.

I'm pretty sure that, if you said, "use library X, version XYZ", then
the worldwide usage of R is sufficiently broad that people would step
forward and help make sure those libraries are packaged for all OS.  I
mean, if there were no tktable package for any linux for which I make
packages (RedHat, Fedora, Debian, Ubuntu), I would create the
packages.   But I'm not doing it now because I have no reason to
believe that is a good path from here on out.


--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: need gui matrix editor: does R Core team have advice on how?

Gabor Grothendieck
On Sat, Jan 28, 2012 at 2:59 PM, Paul Johnson <[hidden email]> wrote:

> Dear R-devel:
>
> Would R core team consider endorsing a graphical toolkit and trying to
> facilitate development of little GUI tools?
>
> I need a gui matrix editor for users that want to be able to write
> matrices that are later used to simulate data.  Instead of teaching
> them to write a covariance matrix (for example, for mvtnorm), I want
> to tell them run a function that pops up a table they can fill in.
>
> The users need to be able to enter variable names in the matrix, so
> something that would accept
>
> a  0  0
> 0  b  0
> c  d  e
>
> would be great.  Something that would accept formulae like this would
> be even more great.
>
> a  0  0
> 0  b  a^2
> c  d  e
>
> I want this gui matrix editor to "just work" on Windows, Mac, Linux. I
> don't mind building this on top of some widget set, but it is
> important that the widget set be easily installable on the user end.
>
> That's why I wish R core would offer us some guidance or advice.  I'm
> not a programmer, but I can learn to program with a library, as long
> as it is not a waste of time.
>
> I've been searching R archives and here's what I found so far.
>
> 1. tcl/tk
>
> Building on R tcltk2, for people that have the Tcl addon widget
> TkTable installed, there are several packages.  in tcltk2 itself,
> there is a function tk2edit, and there are others that try to
> embellish.  I've tried several of these, they seem to be not-quite
> done yet, one can't copy a rectangle, for example. But maybe I could
> learn how to fix them up and make yet another tktable based editor.
>
> Problem: requires user to have enough understanding to install the Tcl
> widget TkTable.  And, for platforms like Windows, user has to install
> tcl/tk itself.

Regarding Windows, both the tcltk R package and tcl/tk itself are
included with R for Windows and work out of the box without doing
anything special.   You can use addTclPath(libdir) to add additional
locations to the tcl library search path so you can include additional
tcl/tk packages in your R package and in conjunction with
system.file(..., package = "myPackage") you can have them
automatically accessed without the user having to do anything special.
 Also you can use all or nearly all of tcl's facilities including
sourcing your own tcl code and you can issue tcl commands one by one
from R too using the facilities of the tcltk package.  There are also
various other R packages that build on top of tcltk.

I too think that a standard R installation should ensure that tcltk
just works out of the box but that seems not to be the case for every
R distribution although it is true for some (possibly most) including
the standard Windows distribution.


--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: need gui matrix editor: does R Core team have advice on how?

Fox, John
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. On Mac OS X, it's necessary for the user to
install Tcl/Tk for X Windows and to insure that X Windows is installed (as
it typically is in recent releases of Mac OS X). In my experience, most
Linux users already have Tcl/Tk and X Windows (or if they don't, they're
familiar with how to install software on their systems), so that things work
smoothly there as well.

The upshot of this is that Mac OS X is the platform that seems to generate
the most problems for naive users, although installing Tcl/Tk for X Windows
isn't that difficult. Take a look, e.g., at the Rcmdr installation notes
<http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html>.

I hope this helps,
 John

--------------------------------
John Fox
Senator William McMaster
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox



> -----Original Message-----
> From: [hidden email] [mailto:r-devel-bounces@r-
> project.org] On Behalf Of Gabor Grothendieck
> Sent: January-28-12 4:33 PM
> To: Paul Johnson
> Cc: R Devel List
> Subject: Re: [Rd] need gui matrix editor: does R Core team have advice
> on how?
>
> On Sat, Jan 28, 2012 at 2:59 PM, Paul Johnson <[hidden email]>
> wrote:
> > Dear R-devel:
> >
> > Would R core team consider endorsing a graphical toolkit and trying
> to
> > facilitate development of little GUI tools?
> >
> > I need a gui matrix editor for users that want to be able to write
> > matrices that are later used to simulate data.  Instead of teaching
> > them to write a covariance matrix (for example, for mvtnorm), I want
> > to tell them run a function that pops up a table they can fill in.
> >
> > The users need to be able to enter variable names in the matrix, so
> > something that would accept
> >
> > a  0  0
> > 0  b  0
> > c  d  e
> >
> > would be great.  Something that would accept formulae like this
> would
> > be even more great.
> >
> > a  0  0
> > 0  b  a^2
> > c  d  e
> >
> > I want this gui matrix editor to "just work" on Windows, Mac, Linux.
> I
> > don't mind building this on top of some widget set, but it is
> > important that the widget set be easily installable on the user end.
> >
> > That's why I wish R core would offer us some guidance or
> advice.  I'm
> > not a programmer, but I can learn to program with a library, as long
> > as it is not a waste of time.
> >
> > I've been searching R archives and here's what I found so far.
> >
> > 1. tcl/tk
> >
> > Building on R tcltk2, for people that have the Tcl addon widget
> > TkTable installed, there are several packages.  in tcltk2 itself,
> > there is a function tk2edit, and there are others that try to
> > embellish.  I've tried several of these, they seem to be not-quite
> > done yet, one can't copy a rectangle, for example. But maybe I could
> > learn how to fix them up and make yet another tktable based editor.
> >
> > Problem: requires user to have enough understanding to install the
> Tcl
> > widget TkTable.  And, for platforms like Windows, user has to
> install
> > tcl/tk itself.
>
> Regarding Windows, both the tcltk R package and tcl/tk itself are
> included with R for Windows and work out of the box without doing
> anything special.   You can use addTclPath(libdir) to add additional
> locations to the tcl library search path so you can include additional
> tcl/tk packages in your R package and in conjunction with
> system.file(..., package = "myPackage") you can have them
> automatically accessed without the user having to do anything special.
>  Also you can use all or nearly all of tcl's facilities including
> sourcing your own tcl code and you can issue tcl commands one by one
> from R too using the facilities of the tcltk package.  There are also
> various other R packages that build on top of tcltk.
>
> I too think that a standard R installation should ensure that tcltk
> just works out of the box but that seems not to be the case for every
> R distribution although it is true for some (possibly most) including
> the standard Windows distribution.
>
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

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

Prof Brian Ripley
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).

> On Mac OS X, it's necessary for the user to
> install Tcl/Tk for X Windows and to insure that X Windows is installed (as
> it typically is in recent releases of Mac OS X). In my experience, most
> Linux users already have Tcl/Tk and X Windows (or if they don't, they're
> familiar with how to install software on their systems), so that things work
> smoothly there as well.
>
> The upshot of this is that Mac OS X is the platform that seems to generate
> the most problems for naive users, although installing Tcl/Tk for X Windows
> isn't that difficult. Take a look, e.g., at the Rcmdr installation notes
> <http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html>.

If this were really a problem it could be resolved with far less effort
than was needed on Windows.  The X11 version of Tk is only needed to get
R's tcltk to play under R.app.  For those wanting a Tk-based front end
for command-line R, it is easy to build R against the Tcl/Tk which ships
with OS X (or an update of it) and get fully Aqua-themed widgets.  If I
want to show Rcmdr to a Mac user, that is what I use.

As various recent threads on R-sig-mac show, some useRs are capable of
misconfiguring their Macs so that X11 does not work, does not find any
fonts ... but maybe they could manage the same on any other Unix-alike.

> I hope this helps,
>   John
>
> --------------------------------
> John Fox
> Senator William McMaster
>    Professor of Social Statistics
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> http://socserv.mcmaster.ca/jfox
>

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

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

Gabor Grothendieck
On Sun, Jan 29, 2012 at 7:10 AM, Prof Brian Ripley
<[hidden email]> 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).
>
>> On Mac OS X, it's necessary for the user to
>> install Tcl/Tk for X Windows and to insure that X Windows is installed (as
>> it typically is in recent releases of Mac OS X). In my experience, most
>> Linux users already have Tcl/Tk and X Windows (or if they don't, they're
>> familiar with how to install software on their systems), so that things
>> work
>> smoothly there as well.
>>
>> The upshot of this is that Mac OS X is the platform that seems to generate
>> the most problems for naive users, although installing Tcl/Tk for X
>> Windows
>> isn't that difficult. Take a look, e.g., at the Rcmdr installation notes
>>
>> <http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html>.
>
>
> If this were really a problem it could be resolved with far less effort than
> was needed on Windows.  The X11 version of Tk is only needed to get R's
> tcltk to play under R.app.  For those wanting a Tk-based front end for
> command-line R, it is easy to build R against the Tcl/Tk which ships with OS
> X (or an update of it) and get fully Aqua-themed widgets.  If I want to show
> Rcmdr to a Mac user, that is what I use.
>
> As various recent threads on R-sig-mac show, some useRs are capable of
> misconfiguring their Macs so that X11 does not work, does not find any fonts
> ... but maybe they could manage the same on any other Unix-alike.
>

Although it would be ideal if the tcltk package just worked out of the
box on every platform so that cross platform GUIs "just worked" if
that is too difficult to manage it would still be helpful if tcl
without tk "just worked" on every platform out of the box for other
applications not involving GUIs but still involving tcl.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

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

PaulJohnson32gmail
In reply to this post by Prof Brian Ripley
On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley
<[hidden email]> 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.

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:

> library(RGtk2Extras)
> mat <- matrix(rnorm(100), 10, 10)
> dfedit(mat)

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:

> library(tcltk2)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
> ?tk2edit
>   data(iris)
>      tk2edit(iris)
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.

> 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

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

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

> library(gWidgetstcltk)
> mat <- matrix(100, 10, 10)
> gdf(mat)
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
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

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

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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

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

Simon Urbanek
In reply to this post by PaulJohnson32gmail

On Jan 29, 2012, at 5:35 PM, Paul Johnson wrote:

> On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley
> <[hidden email]> 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.
>

I can certainly second that (but I may be biased by having to deal with its infelicities - I would also prefer to have a working native toolkit in the binary distribution). Tcl/Tk is not a graphical toolkit, it is a language that happens to support some kind of graphical interface but I would certainly not recommend it as a GUI toolkit. My interpretation is that its presence in R is purely historical (it was an option that someone wrote code for at the time). That said, given the lack of choices, a lot of code was based on it. Now with the advent of packages, you have the choice - there are many toolkits you can choose from now.

This is just my $0.02, not an "official" endorsement ;).

Cheers,
Simon



> 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:
>
>> library(RGtk2Extras)
>> mat <- matrix(rnorm(100), 10, 10)
>> dfedit(mat)
>
> 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:
>
>> library(tcltk2)
> Loading required package: tcltk
> Loading Tcl/Tk interface ... done
>> ?tk2edit
>>  data(iris)
>>     tk2edit(iris)
> 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.
>
>> 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
>
> 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
>
> If I make the other selection, opting for Gtk2, I don't get an error,
> but nothing happens--no table pops up either.
>
>> library(gWidgetstcltk)
>> mat <- matrix(100, 10, 10)
>> gdf(mat)
> 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
> --
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

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

Kevin Coombes
In reply to this post by PaulJohnson32gmail


On 1/29/2012 4:35 PM, Paul Johnson wrote:

> On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley
> <[hidden email]>  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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

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

Duncan Murdoch-2
On 30/01/2012 9:17 AM, Kevin R. Coombes wrote:

>
> On 1/29/2012 4:35 PM, Paul Johnson wrote:
> >  On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley
> >  <[hidden email]>   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....

Just one addition:  the full Tcl/Tk documentation should be available to
most users.  It is included in the Windows distribution (and referenced
from the ?tcltk help page) and I would guess other platforms install it
when they install Tcl/Tk.  It is written assuming that you're writing in
Tcl rather than R, but once you work out the translation, it's actually
somewhat usable.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel