[C++-sig] Re: Using a phython function as callback
Nikolay Mladenov
nickm at sitius.com
Tue Jun 24 21:29:16 CEST 2003
See this
http://boost.org/libs/python/doc/v2/call.html
jochen wrote:
>
> Hello everybody.
>
> I have a class
>
> class Selectable
> {
> ...
> };
>
> which I exported to be part of my python module.
>
> Now I wrote a Python function:
>
> def UpdateSelectedObject( i_Selectable ):
>
> # do something with the Selectable instance.
> return
>
> I got access to the function via the dict of my module.
> Now I wan't to use PyObject_CallObject() to call the function.
> But how do I pass a instance of type Selectable to the function.
>
> Passing a integer or string is easy, because there a functions available
> from the PythonAPI.
> But how do I wrap my instance of type Selectable into a PyObject ?
>
> Can I use part of the boost api do this, I mean this is exactly what boost
> does, isn't it.
>
> Can anybody help a bloody beginner ?
More information about the Cplusplus-sig
mailing list