PlatformEventLoop Class

Inheritance diagram of PlatformEventLoop

class PlatformEventLoop

Abstract class, implementation depends on platform.

Note

Since pyglet 1.2

Constructor:

__init__()

Methods:

dispatch_posted_events() Immediately dispatch all pending events.
is_running() Return True if the event loop is currently processing, or False
notify() Notify the event loop that something needs processing.
post_event(dispatcher, event, *args) Post an event into the main application thread.
set_timer(func, interval)
start()
step([timeout])
TODO:in mac/linux: return True if didn’t time out
stop()

Methods

PlatformEventLoop.dispatch_posted_events()

Immediately dispatch all pending events.

Normally this is called automatically by the runloop iteration.

PlatformEventLoop.is_running()

Return True if the event loop is currently processing, or False if it is blocked or not activated.

Return type:bool
PlatformEventLoop.notify()

Notify the event loop that something needs processing.

If the event loop is blocked, it will unblock and perform an iteration immediately. If the event loop is running, another iteration is scheduled for immediate execution afterwards.

PlatformEventLoop.post_event(dispatcher, event, *args)

Post an event into the main application thread.

The event is queued internally until the run method’s thread is able to dispatch the event. This method can be safely called from any thread.

If the method is called from the run method’s thread (for example, from within an event handler), the event may be dispatched within the same runloop iteration or the next one; the choice is nondeterministic.

Parameters:
  • dispatcher (EventDispatcher) – Dispatcher to process the event.
  • event (str) – Event name.
  • args (sequence) – Arguments to pass to the event handlers.
PlatformEventLoop.set_timer(func, interval)
PlatformEventLoop.start()
PlatformEventLoop.step(timeout=None)
TODO:in mac/linux: return True if didn’t time out
PlatformEventLoop.stop()

Table Of Contents

Previous topic

EventLoop Class

Next topic

WeakSet Class