[Tkinter-discuss] How to do things before Tk window creation
--or--, how to perform initial window initialization correctly ?
Jeff Epler
jepler at unpythonic.net
Fri Apr 2 09:29:28 EST 2004
You can create your Tk application and immediately withdraw the main
window. Something like this:
t = Tkinter.Tk()
t.wm_withdraw()
# other setup here
t.wm_deiconify()
t.raise()
t.mainloop()
On the other hand, you should be able to run code between creation of
Tk() and t.mainloop during which time no window is shown (I tested this
on Unix only):
import Tkinter, time
t = Tkinter.Tk()
print "created"
time.sleep(1)
print "done with setup"
t.mainloop()
... the window doesn't appear until after "done with setup" is printed.
You can make calls like 't.bind_class()' instead of calling sleep.
If you make calls like 't.update_idletasks()', though, the window will
appear.
Jeff
More information about the Tkinter-discuss
mailing list