gobject.MainContextan object representing a set of event sources to be handled
in a gobject.MainLoop.Synopsisgobject.MainContextgobject.MainContextiterationmay_blockpendingAncestry+-- gobject.MainContext
DescriptionA gobject.MainContext
represents a set of event sources that can be run in a single thread. File
descriptors (plain files, pipes or sockets) and timeouts are the standard
event sources for GTK and PyGTK though
others can be added. Each event source is assigned a priority. The default
priority, gobject.PRIORITY_DEFAULT, is 0. Values less
than 0 denote higher priorities. Values greater than 0 denote lower
priorities. Events from high priority sources are always processed before
events from lower priority sources. Single iterations of a gobject.MainContext
can be run with the iteration()
method.Constructorgobject.MainContextReturns :a new gobject.MainContext
object.Creates a new gobject.MainContext
object.Methodsgobject.MainContext.iterationiterationmay_block :if True the call may block
waiting for an event.Returns :True if events were
dispatched.The iteration() method runs a single
iteration. This involves:checking to see if any associated event sources are ready
to be processed;then if no events sources are ready and
may_block is True, waiting for a
source to become ready;and finally, dispatching the highest priority events
sources that are readyNote that even when may_block is
True, it is still possible for
iteration() to return False,
since the the wait may be interrupted for other reasons than an event source
becoming ready.gobject.MainContext.pendingpendingReturns :True if events are
pending.The pending() method checks if any
associated sources have pending events.