Python Forum

Full Version: [split] What is a GUI's mainloop ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what exactly is mainloop for? What is it´s purpose?
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.