Python Forum
tkinter help please
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter help please
#4
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:
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()),
Reply


Messages In This Thread
tkinter help please - by juliolop - Mar-22-2023, 07:45 PM
RE: tkinter help please - by deanhystad - Mar-24-2023, 05:35 PM
RE: tkinter help please - by juliolop - Mar-29-2023, 07:13 PM
RE: tkinter help please - by deanhystad - Mar-30-2023, 02:50 AM
RE: tkinter help please - by juliolop - Apr-03-2023, 06:13 PM
RE: tkinter help please - by deanhystad - Apr-03-2023, 07:51 PM
RE: tkinter help please - by juliolop - Apr-04-2023, 04:04 PM
RE: tkinter help please - by deanhystad - Apr-04-2023, 05:56 PM
RE: tkinter help please - by juliolop - Apr-06-2023, 07:04 PM
RE: tkinter help please - by juliolop - Apr-06-2023, 08:16 PM
RE: tkinter help please - by deanhystad - Apr-06-2023, 08:36 PM
RE: tkinter help please - by deanhystad - Apr-10-2023, 03:42 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020