Tk and focusing windows

Graham Ashton graz at mindless.com
Wed Oct 24 03:16:06 EDT 2001


I've got an application which opens two Tk windows as soon as it starts
up; the main window and a progress dialog.

I want the dialog to be displayed after the main window (so the main
window can't cover it up), but the way my code is currently structured I
call mainloop() immediately after creating the dialog. The code for the
main window is done first.

The main window is instantiated with "root = Tk()" before anything else
happens, and the dialog is created with Toplevel().

Can somebody give me a brief rundown of what I should be doing to avoid
this? Setting the focus (i.e. calling lift()) doesn't work, and even if it
did there would still be the problem of the dialog being shown first, so
window tiling makes for strange behaviour on windows.

I'm trying to create the main window, then the dialog, and have them
displayed on screen in that order.

Thanks.

--
Graham



More information about the Python-list mailing list