[R] Tcl/Tk window lingering too long

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Feb 22 21:15:05 CET 2002


David Firth <david.firth at nuffield.oxford.ac.uk> writes:

> Many thanks to Brian and Peter for their swift and helpful responses.
> 
> I tried Peter's suggestion (I think), as in
> 
> test<-function(){
> 	base<-tktoplevel()
> 		ok.but<-tkbutton(base,text="OK",
> 		         command=function(){
> 		             tkdestroy(base)
> 		             })
> 		tkpack(ok.but)
> 		tkwait.window(base)
> 	x<-rnorm(400000)
>          print("finished")}
> 
> but that version seems to have the same problem as before.
> 
> David

Drats!

Hmm. Inserting a .Tcl("update") does the trick. I'm slightly worried
about some of the "update considered evil" things I've heard - see
http://mini.net/tcl/1255.html. Looks like it would be fairly safe to
run it at top level, though. (At any rate there ought to be a
tkupdate() function, but there's not - yet...)

The Windows version runs the Tcl loop periodically during computations
which is why we aren't seeing this effect there. Unix-alikes only
check for events when waiting for keyboard input or when explicitly
requested.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list