[vtkusers] Using a C++ vtk object from Python

Scott Harris scottrharris at gmail.com
Thu Dec 22 12:39:12 EST 2005


I'm trying to build an application on Mac OS X that uses Python,
Objective-C, and C++ and I'm having issues since some of my vtk
objects are built by C++ and some are built by Python. How can I make
these objects talk to each other?

I'm using C++ to build my vtkRenderer, but I'd like to use Python to
build all my actors so I can play around interactively. How do I add a
vtkActor that I built in Python to a vtkRenderer that was built in C++
if all I have is a pointer to the C++ object? Or how can I get the
pointer to the C++ vtkRender that's inside the python object created
with r=vtk.vtkRenderer()? If I could get that, I could replace the
vtkRenderer on the C++ side with the one inside the Python object and
then I could just do all my work on the python side (maybe?).

In general, how can I set up object in Python that shadows objects in
C++? I'd like to take the C++ pointer and generate a Python object
that I can then just call methods on like it was an ordinary Python
object.

Thanks,
-Scott



More information about the vtkusers mailing list