Michael Lawrence
2008-Apr-05 11:55 UTC
[Rd] Odd tcltk and Rattle interference on MS/Windows
Hi Graham, Your guess is right. The event loop stuff is handled differently on Windows than on Unix-like OSes. There is a hook, called tcl_do that is hard-coded into the R Windows GUI. It is called whenever the console is idle. RGtk2 is able to hook into that to process GTK+ events. The problem is that the two packages replace each other's handler. So in this case tcltk is blocking GTK+ from processing its events. Perhaps these packages should "chain up" to an existing handler. I'll do that for RGtk2, but I have no control over tcltk of course. Michael On Sat, Apr 5, 2008 at 3:57 AM, Graham Williams < Graham.Williams@togaware.com> wrote:> Hi Michael, > > I'm not sure if this is RGtk2 related yet, but just in case it rang > any bells with you.... I'm using version 2.12.5 on R 2.6.2. > > On MS/Windows (not on GNU/Linux) if the tcltk package is loaded whilst > Rattle is running, Rattle freezes (or is running exceedingly > slowly). If tcltk is loaded before Rattle is started, all is okay! > > I.e., The following order of things works just fine: > > > library(rattle) > > library(tcltk) > > rattle() > > But the following freezes Rattle: > > > library(rattle) > > rattle() > > library(tcltk) > > I'm thinking it is an issue between RGtk2 and tcltk, but don't have > any good evidence yet. However, pmg is also affected in exactly the > same way, viz: > > > library(tcltk) > > library(pmg) > > works just fine but > > > library(pmg) > > library(tcltk) > > results in pmg freezing. > > Any ideas - is it perhaps tcltk's problem? > > Regards, > Graham >[[alternative HTML version deleted]]
Graham Williams
2008-Apr-05 20:49 UTC
[Rd] Odd tcltk and Rattle interference on MS/Windows
Thanks for the information. A little more testing..... With R 2.6.2 on Debian I don't get John's crash on the tkdestroy. With R 2.6.2 on MS/Windows the "library(tcltk)" causes the gtkWindow to freeze. The tkdestroy works just fine. I haven't had a chance to test on the imminent R 2.7.0 yet. The simple test to demonstrate:> library(RGtk2) > w <- gtkWindow() > library(tcltk)# Alt-Tab between windows - the gtkWindow no longer refreshes Regards, Graham Received Sat 05 Apr 2008 10:56pm +1100 from Michael Lawrence:> Hi Graham, > > Your guess is right. The event loop stuff is handled differently on > Windows than on Unix-like OSes. There is a hook, called tcl_do that > is hard-coded into the R Windows GUI. It is called whenever the > console is idle. RGtk2 is able to hook into that to process GTK+ > events. The problem is that the two packages replace each other's > handler. So in this case tcltk is blocking GTK+ from processing its > events. > > Perhaps these packages should "chain up" to an existing > handler. I'll do that for RGtk2, but I have no control over tcltk of > course. > > MichaelReceived Sat 05 Apr 2008 11:09pm +1100 from Michael Lawrence:> Well this is definitely interesting. I don't even have tcl/tk installed on > my system, so I can't readily test this. RGtk2 and tcltk definitely > intersect at the event loop, but I'm not sure if these are related to that. > It could be something at the deeper X11 level. > > On Sat, Apr 5, 2008 at 4:56 AM, John Verzani <verzani at math.csi.cuny.edu> > wrote: > > > Dear Graham, > > > > When I try and use RGtk2 and tcltk together the act of closing a > > window in tcltk will often (if not always) cause R to crash. I'm > > guessing it has something to do with the different event loops being > > used, but I don't have anything more than that. > > > > Here is a simple test, on my 2.6.1 linux R, to show that it has > > nothing to do with rattle or pmg: > > > > > library(RGtk2) > > > w <- gtkWindow() > > > library(tcltk) > > > tt <- tktoplevel() > > > tkdestroy(tt) > > The program 'R' received an X Window System error. > > This probably reflects a bug in the program. > > The error was 'BadWindow (invalid Window parameter)'. > > (Details: serial 99 error_code 3 request_code 15 minor_code 0) > > (Note to programmers: normally, X errors are reported asynchronously; > > that is, you will receive the error a while after causing it. > > To debug your program, run it with the --sync command line > > option to change this behavior. You can then get a meaningful > > backtrace from your debugger if you break on the gdk_x_error() > > function.) > > > > --John > > > > > > > > On Sat, Apr 5, 2008 at 7:06 AM, Graham Williams > > <Graham.Williams at togaware.com> wrote: > > > Hi John, > > > > > > Meant to include you in this in case you had come across the problem? > > > (Rattle uses RGtk2 and the problem I describe here affects pmg also.) > > > > > > Regards, > > > Graham > > > > > > ----- Forwarded message from Graham Williams < > > Graham.Williams at togaware.com> ----- > > > > > > Subject: Odd tcltk and Rattle interference on MS/Windows > > > From: Graham Williams <Graham.Williams at togaware.com> > > > Date: Sat, 5 Apr 2008 21:57:11 +1100 > > > To: Michael Lawrence <lawremi at iastate.edu> > > > Reply-To: Graham.Williams at togaware.com > > > User-Agent: Mutt/1.5.17+20080114 (2008-01-14) > > > > > > Hi Michael, > > > > > > I'm not sure if this is RGtk2 related yet, but just in case it rang > > > any bells with you.... I'm using version 2.12.5 on R 2.6.2. > > > > > > On MS/Windows (not on GNU/Linux) if the tcltk package is loaded whilst > > > Rattle is running, Rattle freezes (or is running exceedingly > > > slowly). If tcltk is loaded before Rattle is started, all is okay! > > > > > > I.e., The following order of things works just fine: > > > > > > > library(rattle) > > > > library(tcltk) > > > > rattle() > > > > > > But the following freezes Rattle: > > > > > > > library(rattle) > > > > rattle() > > > > library(tcltk) > > > > > > I'm thinking it is an issue between RGtk2 and tcltk, but don't have > > > any good evidence yet. However, pmg is also affected in exactly the > > > same way, viz: > > > h > > > > library(tcltk) > > > > library(pmg) > > > > > > works just fine but > > > > > > > library(pmg) > > > > library(tcltk) > > > > > > results in pmg freezing. > > > > > > Any ideas - is it perhaps tcltk's problem? > > > > > > Regards, > > > Graham > > > > > > ----- End forwarded message ----- > > > > > > -- > > > This message has been scanned for viruses and > > > dangerous content by MailScanner, and is > > > believed to be clean. > > > > > > > > > > > > > > -- > > John Verzani > > CUNY/CSI Department of Mathematics > > verzani at math.csi.cuny.edu > >
Prof Brian Ripley
2008-Apr-06 06:09 UTC
[Rd] Odd tcltk and Rattle interference on MS/Windows
I don't recognize your account. R under Windows has an entry point R_tcldo, which is *private* and (as its name implies) for use by R with Tcl. There is no documentation that I am aware of that suggests that it is available to packages, and it is in no header and not in 'Writing R Extensions'. It is not part of the 'Windows GUI': it works the same with all R for Windows front ends. On Sat, 5 Apr 2008, Michael Lawrence wrote:> Hi Graham, > > Your guess is right. The event loop stuff is handled differently on Windows > than on Unix-like OSes. There is a hook, called tcl_do that is hard-coded > into the R Windows GUI. It is called whenever the console is idle. RGtk2 is > able to hook into that to process GTK+ events. The problem is that the two > packages replace each other's handler. So in this case tcltk is blocking > GTK+ from processing its events. > > Perhaps these packages should "chain up" to an existing handler. I'll do > that for RGtk2, but I have no control over tcltk of course. > > Michael > > On Sat, Apr 5, 2008 at 3:57 AM, Graham Williams < > Graham.Williams at togaware.com> wrote: > >> Hi Michael, >> >> I'm not sure if this is RGtk2 related yet, but just in case it rang >> any bells with you.... I'm using version 2.12.5 on R 2.6.2. >> >> On MS/Windows (not on GNU/Linux) if the tcltk package is loaded whilst >> Rattle is running, Rattle freezes (or is running exceedingly >> slowly). If tcltk is loaded before Rattle is started, all is okay! >> >> I.e., The following order of things works just fine: >> >>> library(rattle) >>> library(tcltk) >>> rattle() >> >> But the following freezes Rattle: >> >>> library(rattle) >>> rattle() >>> library(tcltk) >> >> I'm thinking it is an issue between RGtk2 and tcltk, but don't have >> any good evidence yet. However, pmg is also affected in exactly the >> same way, viz: >> >>> library(tcltk) >>> library(pmg) >> >> works just fine but >> >>> library(pmg) >>> library(tcltk) >> >> results in pmg freezing. >> >> Any ideas - is it perhaps tcltk's problem? >> >> Regards, >> Graham >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at 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, UK Fax: +44 1865 272595