Mar-30-2023, 02:50 AM
(This post was last modified: Mar-30-2023, 02:50 AM by deanhystad.)
What do you mean by "moved the windows opening". You do not open windows. root.mainloop() opens windows. There will be no indication of anything happening in a tkinter application before root.mainloop is called. Once root.mainloop() is called, creating a new window will result in it appearing almost immediately, because mainloop() will see there is a new window, and it will draw the window to the screen.
Of course there is the small problem that mainloop() is blocking. It does not return untill all windows are closed. I suppose you could do something like this:
Of course there is the small problem that mainloop() is blocking. It does not return untill all windows are closed. I suppose you could do something like this:
import tkinter # Make your first window root = tkinter.Tk() tkinter.Label(root, text="1").pack() root.mainloop() # Will wait here until you close the root window # make your second window root = tkinter.Tk() tkinter.Label(root, text="2").pack() root.mainloop()I don't know why anyone would do this instead of writing individual programs that could be run in any order, but this does follow the tkinter pattern of making the window, calling mainloop(), wait for windows to close. Continue with remainder of program (usually there is nothing after mainloop()),