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

Burlen burlen at apollo.sr.unh.edu
Thu Dec 22 13:28:22 EST 2005


if you use swig you can return vtk objects to python from c++:

return (PyObject *) vtkPythonGetObjectFromPointer(...)

might also work if not using swig but that's the only way I ever tried it.

see:
http://quaoar.sr.unh.edu/Python/HOWTO_wrapping_vtk.html

On Thursday 22 December 2005 12:39 pm, Scott Harris wrote:
> 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
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-- 

Burlen Loring
Space Science Center
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
39 College Road, Durham, NH 03824
Phone: 603-862-1140



More information about the vtkusers mailing list