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
MainLoop
structure.- Parameters:
context – a
MainContext
(ifNone
, 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 callingrun
will set this toTrue
anyway.
Methods#
- class MainLoop
- get_context() MainContext #
Returns the
MainContext
ofloop
.
- quit() None #
Stops a
MainLoop
from running. Any calls torun
for the loop will return.Note that sources that have already been dispatched when
quit
is called will still be executed.
- run()#
Runs a main loop until
quit
is 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.