[vtkusers] Creating vtk "plugins" for python.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Sun Dec 15 21:04:54 EST 2002


>>>>> "AG" == Alexandre Guimond <vtk at guim.org> writes:

    AG> VTK contains the Wrapping/Python directory which contains
    AG> quite a few things to setup loadable vtk modules in python.
    AG> From what I understand, they get installed in
    AG> lib/python2.2/site-packages.  My vtkag/Wrapping only contains
    AG> an empty hints file.

    AG> Does anyone know what I have to do to to setup something
    AG> similar so I can load my package from python?

Simply add the directory that contains your libvtkMyPython.so (or
whatever its called) to PYTHONPATH and to import the module do this:

 from libvtkMyPython import *

Alternatively for a more cross platform situation you can add a file
called vtkmy.py in that directory that contains this:

import os

if os.name == 'posix':
    from libvtkMyPython import *
else:
    from vtkMyPython import *

And in your code just say:

import vtkmy

cheers,
prabhu



More information about the vtkusers mailing list