Python Forum
[split] What is a GUI's mainloop ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] What is a GUI's mainloop ?
#1
what exactly is mainloop for? What is it´s purpose?
Reply
#2
The mainloop is a infinite loop that runs until no windows are open anymore.
It is responsible for the drawing of the widgets and checking for events like button clicks.
If the mainloop is interrupted by long running code or a time.sleep the GUI widgets wont get redrawn,
the GUI will lockup and no events can happen.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TKinter restarting the mainloop when button pressed zazas321 7 16,091 Jan-26-2021, 06:38 AM
Last Post: zazas321
  [Tkinter] Is mainloop() necessary? escape_freedom13 2 12,633 Sep-01-2019, 02:49 PM
Last Post: escape_freedom13
  [Tkinter] sleep(n) not working inside tkinter mainloop roger31415 2 5,128 Jul-14-2019, 06:57 PM
Last Post: wuf
  [Tkinter] ttk.barprogress - root.mainloop francisco_neves2020 11 6,143 Apr-10-2019, 01:06 PM
Last Post: francisco_neves2020
  [Tkinter] How to update the gui in a loop without blocking the gui mainloop Qnuba 2 65,492 Nov-12-2016, 04:33 PM
Last Post: Qnuba

Forum Jump:

User Panel Messages

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