events Submodule

The procgame.events submodule contains general purpose classes for passing events around.

Classes

Event

class procgame.events.Event(name, object, info)

Describes an event dispatched by EventManager.

info

Any information associated with the event.

name

Name of the event.

object

Object this event is associated with.

EventManager

class procgame.events.EventManager

Dispatches events to event handlers. Until better documentation is created, it may be helpful to know that this class is strongly influenced by the Cocoa class NSNotificationCenter.

Most users will want to obtain the default instance using default():

EventManager.default().add_event_handler(...)
add_event_handler(name, handler, object=None)

Handlers take a single parameter, the Event object being posted.

classmethod default()

Returns the default (shared) EventManager instance.

post(name, object=None, info=None)

Post an Event with the given properties.

post_event(event)

Post the given Event instance. Blocks while the resulting handlers are called.

remove_event_handler(handler)

Remove the given handler.

Table Of Contents

Previous topic

dmd Submodule

Next topic

game Submodule

This Page