in reply to window focus and stacking in TK
use $toplevel->raise() or $toplevel->raise($other_toplevel) to influence stacking order.
Also there is a ->focus method that juust might happen to do what you want. Cheers, alf