[Rd] Odd tcltk and Rattle interference on MS/Windows

Graham Williams Graham.Williams at togaware.com
Sat Apr 5 22:49:45 CEST 2008


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.
>
> Michael

Received 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
> >



More information about the R-devel mailing list