[Rd] tcltk freezing using MS Windows for R-2.14+

Mark.Bravington at csiro.au Mark.Bravington at csiro.au
Wed Dec 19 07:01:10 CET 2012

Just a caveat about Sys.sleep() etc style fixes:

I've had long-standing problems with tcltk on Windows in my 'debug' package-- i.e. for at least 7 years. The typical syndrome is that the debug window appears just as an empty frame, which has to be manually minimized/maximized/restored (or some permutation thereof) to get it to work properly. The problem is specific to particular machines, particular R versions (it seemingly went away between about 2.8 and 2.13), and indeed to the complexity of stuff in the debug window (more is often better), so reproducible examples are basically impossible. I've tried numerous times changing the order of creation, inserting random calls to 'tkupdate' and/or 'tkupdate idletasks', inserting Sys.sleep(X), etc. Sometimes they seem to work, for a while--- but then they inevitably don't, on someone's machine for some particular problem. So, sorry to be a wet blanket, but I wouldn't get too excited about the reliability of any fix...

Note that I don't recall anyone reporting problems with 'debug' on Linux--- one reason I'm reasonably sure it's not a problem in my code, despite my not properly understanding tcl/tk. On my own machines (Windows), I long-ago fixed the annoyance by writing a DLL that automatically maximizes-minimizes-restores (or whatever), so it doesn't bother me--- but the solution is not CRAN-friendly. I actually do have a beta version of debug with a series of horrible bodges that *may* solve the problem generally (trying to mimic the minimize-maximize-restore sequence), but it's monkeys-on-typewriters stuff, and experience suggests it probably won't work.

Of course, all this isn't the same as total freezing, but my guess is that the same swamp monster is responsible. I think Peter Dalgaard's comment applies; there's something nasty going on between the tcltk and R "event loops". That's as much as I know, and as much as I want to know, since it's way beyond me to fix--- but I live in hope that someone more heroic may one day be able to! 


Mark Bravington
CSIRO Mathematical & Information Sciences
Marine Laboratory
Castray Esplanade
Hobart 7001

ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623

> -----Original Message-----
> From: r-devel-bounces at r-project.org 
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Keith
> Sent: Wednesday, 19 December 2012 4:28 PM
> To: Moeltner, Andreas
> Cc: raffaele.calogero at gmail.com; 'r-devel at r-project.org'
> Subject: Re: [Rd] tcltk freezing using MS Windows for R-2.14+
> Andreas,
> thanks so much for this clue.
> I have found that if I reduced the time in seconds from 0.1 to 0.01 to
> 0.001 to 0.0001 I only had problems with freezing on the 0.0001 time.
> I tested on Win7(64 bit) on an Intel core i7 870 at 2.93GHz 
> (16GB ram)(8
> cores)
> and a WinXP (32bit) Pentium 4 3.01GHz (2GB ram) using
> R-2.15.2(2012-10-26) on both.
> I had previously found that the tkgrab.set command seemed to 
> be the one actually freezing so I placed the sleep command 
> just before that with the same result as it being just after 
> the tktoplevel command.
> I am now going to try it in my packages affylmGUI and 
> limmaGUI, probably with a sleep time of 0.1 to be on the safe side,
> many thanks,
> Keith Satterley
> On 18/12/2012 9:38 PM, Moeltner, Andreas wrote:
> > R Version 2.15.0/Windows XP
> >
> > Maybe this will help to identify the problem (I have 
> similar problems 
> > with other tcltk-windows, too.)
> >
> > Inserting some time delay after tktoplevel helps (on my PC):
> >
> >> test2GUI <- function(){
> >>      require(tcltk)
> >>      MainWindow <- tktoplevel()
> > Sys.sleep(0.1)
> >>      topMenu <- tkmenu(MainWindow)
> >>      tkconfigure(MainWindow,menu=topMenu)
> >>      tkgrab.set(MainWindow)
> >>      tkfocus(MainWindow)
> >> }
> > Cheers
> > Andreas
> >
> >
> > Andreas Möltner
> ______________________________________________________________________
> The information in this email is confidential and 
> intend...{{dropped:4}}
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list