There are a number of interfaces in cs and cel which can serve as callbacks to discover things happening in engine. To be able use this functionality, one must inherit from special base classes for python.
There are two modules in csexternal repository that provide such classes, one for cs and one for cel: cscallback and celcallback.
In general for a given interface, there is a base class, with the naming convention of prefixing with py instead of i as is normal for interfaces.
For example, in iMovableListener this would be pyMovableListener. And to use it just declare your class inheriting from this, and implement the needed functions in interface from python:
# ObjectRegistry defined elsewhere from cscallback import pyMovableListener class MyMovableListener(pyMovableListener): # constructor def __init__(self): pyMovableListener.__init__(self,ObjectRegistry) # callback functions def MovableChanged(movable): print "movable changed" def MovableDestroyed(movable): print "movable destroyed"
Note how the constructor for all callback classes requires that you pass the object registry (in the previous example, it is assumed ObjectRegistry is the object registry).