[R] tcltk crashing R after the (ab)use of tkwait
mmeredith at wcs.org
Sun May 27 03:01:04 CEST 2007
>> tt <- tktoplevel()
>> done <- tclVar(0)
>> but <- tkbutton(tt, text="OK", command=function() tclvalue(done) <- 1)
>> works as fine as long as I click the OK. However, if I close
>> the window (by clicking in the X), R enters into an infinite loop
>> and there's no way of returning except by closing the R window.
I have the same pbm with R 1.5.0 on Window XP Home SP2.
I think it's doing what it's supposed to, ie. waiting for done==1, just that
this never happens.
I've stopped using tkwait.variable for just this reason, and use
tkwait.window(tt). You have to be careful to recover the variables you need
before closing the window, so the function attached to the 'OK' button
should take care of that before calling tkdestroy. (See
Variables can be created in .GlobalEnv with <<- which will be availble after
the function exits. See also how Greg Snow uses a purpose-built environment
in his 'TeachingDemos' package.
R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/tcltk-crashing-R-after-the-%28ab%29use-of-tkwait-tf3487962.html#a10821463
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help