Within a loop I tried to draw some things in dependency on the position of the mouse. This works fine with R-1.5.1 but R-1.6.1 requires to include some delay by Sys.sleep(delay) with delay>=0.015. For smaller values (e.g. 0.0001) the top level tcltk-window does not appear and so I am not able to control the elements to be plotted using the tcltk-widget. Question1: How can I force the tcltk-widget to appear / to get the position of the mouse within the loop? Question2: Why isn't it allowed to use the locator function with n=0, with the meaning to output the coordinates of the mouse? ( Then my problem can be solved without Tcl/Tk ) Here is an example: # Definition of function a: # #################################### a<-function(delay=0.015){ library(tcltk) state <-tclVar("relax") number<-tclVar("100") top <-tktoplevel() show <-tklabel (top,textvariable=number) up <-tkbutton(top,text="up") down <-tkbutton(top,text="down") exit <-tkbutton(top,text="exit",command=function() tclvalue(state)<-"exit" ) tkpack(show,up,down,exit) tkbind(up, "<Enter>",function() tclvalue(state)<-"up" ) tkbind(up, "<Leave>",function() tclvalue(state)<-"relax" ) tkbind(down,"<Enter>",function() tclvalue(state)<-"down" ) tkbind(down,"<Leave>",function() tclvalue(state)<-"relax" ) plot(1:400,type="n"); old<-1:2; x<-1; y<-200 repeat{ Sys.sleep(delay) choice <- tclvalue(state) if((x<-x+1)>400) break if(choice=="exit")break if(choice=="up" ) y<-y+1 if(choice=="down") y<-y-1 if(choice=="relax")y<-y points(old[1],old[2],col="red") points(x, y, col="black") tclvalue(number) <- as.character(y) old<-c(x,y) } tkdestroy(top) } # ############################### # a(0.01) is ok, a(0.0001) is not ok by: # # version: # platform hppa2.0-hp-hpux10.20 # arch hppa2.0 # os hpux10.20 # system hppa2.0, hpux10.20 # status # major 1 # minor 6.1 # year 2002 # month 11 # day 01 # language R ############################## Peter Wolf ----------------------------- H.P. Wolf University of Bielefeld, Germany pwolf at wiwi.uni-bielefeld.de