in reply to Tk keep Toplevelwindow on top of its Mainwindow

you can use the following

my $x = (($mw->x)+200); my $y = (($mw->y))+200; $dialog->geometry("+$x+$y"); if ($dialog->parent->toplevel->viewable){$dialog->transient($dialo +g->parent);}