Re: [Rd] tcltk GUIs (was need gui matrix editor: does R Core team have advice on how?)
On 1/29/2012 4:35 PM, Paul Johnson wrote: On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley rip...@stats.ox.ac.uk 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 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] tcltk GUIs (was need gui matrix editor: does R Core team have advice on how?)
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 rip...@stats.ox.ac.uk 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 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] tcltk GUIs (was need gui matrix editor: does R Core team have advice on how?)
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, rip...@stats.ox.ac.uk 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, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] tcltk GUIs (was need gui matrix editor: does R Core team have advice on how?)
On Sun, Jan 29, 2012 at 7:10 AM, Prof Brian Ripley rip...@stats.ox.ac.uk 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 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 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 rip...@stats.ox.ac.uk 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 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] tcltk GUIs (was need gui matrix editor: does R Core team have advice on how?)
On Jan 29, 2012, at 5:35 PM, Paul Johnson wrote: On Sun, Jan 29, 2012 at 6:10 AM, Prof Brian Ripley rip...@stats.ox.ac.uk 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:
Re: [Rd] tcltk GUIs (was need gui matrix editor: does R Core team have advice on how?)
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...) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel