All, I am using the tcltk package (under macos 10.3.8, running R from ESS, R 2.0.0). I am using tcltk libraries from fink: i tcltk 8.4.1-12 Tool Command Language and the Tk toolkit i tcltk-dev 8.4.1-12 Tool Command Language and the Tk toolkit i tcltk-shlibs 8.4.1-12 Tool Command Language and the Tk toolkit #### R CODE PressedOK <- function() { plot(runif(100)*10,runif(100)*10) } tt <- tktoplevel() OK.but <- tkbutton(tt,text="OK",command=PressedOK) tkgrid(OK.but) tkfocus(tt) If I evaluate the above code, it works as expected. However, when completed (I close the "OK" window), if I enter any commands that result in errors by R (commands that don't exist, for example), I get: > dev() Error: couldn't find function "dev" In addition: Warning messages: 1: X11 protocol error: BadWindow (invalid Window parameter) 2: X11 protocol error: BadWindow (invalid Window parameter) 3: X11 protocol error: BadWindow (invalid Window parameter) 4: X11 protocol error: BadWindow (invalid Window parameter) 5: X11 protocol error: BadWindow (invalid Window parameter) 6: X11 protocol error: BadWindow (invalid Window parameter) 7: X11 protocol error: BadWindow (invalid Window parameter) 8: X11 protocol error: BadWindow (invalid Window parameter) However, as soon as I do ls(), for example, the warning messages disappear and don't recur unless I re-execute the code. The archives turned up this thread (https://stat.ethz.ch/pipermail/r-help/2004-August/055212.html), which relates to RCMDr use, but I think is probably general. The thread doesn't look like it comes to a complete resolution. (I did one suggestion, remove the tkfocus call, and get the same result.) I am tempted to ignore the warnings entirely (being lazy when the code works), but just wanted to hear if there are any insights from the list. Thanks, Sean