MainLoop#
- class MainLoop(context=None)#
The GMainLoop struct is an opaque data type
representing the main event loop of a GLib or GTK application.
Constructors#
- class MainLoop
- classmethod new(context: MainContext | None, is_running: bool) MainLoop#
Creates a new
MainLoopstructure.- Parameters:
context – a
MainContext(ifNone, the global-default main context will be used).is_running – set to
Trueto indicate that the loop is running. This is not very important since callingrunwill set this toTrueanyway.
Methods#
- class MainLoop
- get_context() MainContext#
Returns the
MainContextofloop.
- quit() None#
Stops a
MainLoopfrom running. Any calls torunfor the loop will return.Note that sources that have already been dispatched when
quitis called will still be executed.
- run()#
Runs a main loop until
quitis called on the loop. If this is called for the thread of the loop’sMainContext, it will process events from the loop, otherwise it will simply wait.