MainLoop#
- class MainLoop(**kwargs)#
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 main context (if
NULL, the global-default main context will be used).is_running – set to true to indicate that the loop is running. This is not very important since calling
runwill set this to true anyway.
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() None#
Runs a main loop until
quitis called on the loop.If this is called from the thread of the loop’s
MainContext, it will process events from the loop, otherwise it will simply wait.