calling python from c++ through interriage

Where could i find a good example in the code of interrogate generation a python call back? I have dealt with straight C++ call backs before … and they where not too bad too bad but i would like to know how to use panda’s features.

What i want is a C++ class for which i cant set a python function and then have it call that function with parameters each frame.

This is for my pyro particle manager. I want to be able to create “dumb” C++ particles and particles that take python functions but i need to be able to pass the C++ part as self or … some other argument back.

def fun(self)
     # self is c++ CppPart object
     self.move() # c++ function

cpppart = CppPart()
cpppart.setCallBack(fun)

... in cpp some thing like this:
 this->call_back.pycall(this)

There are some examples of this in the direct/src/dcparser directory.

The basic idea is you define your C++ function to receive a PyObject * paramter. Interrogate will then put whatever Python object you pass in that parameter position, unfiltered. Use this parameter to pass a Python function. Then you can use the standard Python/C API calls to call your Python function, e.g. PyObject_CallObject().

David