Hi, I can't reproduce your error, it seems to run Ok here, but it probably
depends on system load and timing, (and maybe Tk version). I did see similar problems in the past, and from my experience, your problem is in "$mw->destroy". Why? Well your DialogBox is a child of $mw, and if you destroy $mw, you destroy the MainLoop (event loop) and leave the $dlg hanging in mid-air. It is better to use Tk::exit ( or even plain exit), to exit a Tk program. Tk::exit will clean up after itself. General rule: Don't use $mw->destroy unless you are trying to continue the script in a non-Tk mode.