[vtkusers] python extended vtk

David Gobbi dgobbi at irus.rri.ca
Sun Feb 3 20:59:59 EST 2002


Hi Ben,

The python wrappers are generated with yacc & VTK-specific
wrappers generators.

Don't even consider asking  'why not use wrapping package X'
unless you search the archives first.  The answer is roughly
- the vtk-python wrappers were written before any of those other
  wrappers generators existed (SWIG was still at a fairly early stage)
- the wrappers work pretty good as they are, and adding features is
  probably easier than switching to a new system
- since all the wrapper-generating code comes with the VTK source,
  people don't have to download any additional packages (this
  is a far bigger benefit than you might think)

Derivation of VTK classes in Python was added recently to CVS.
Support for virtual methods is possible, but only if someone is
willing to write the code that does it (i.e. generate wrapper
subclasses for all VTK classes, doing C++ -> python parameter
conversion, and calling the virtual python method when a virtual
C++ method is called -- quite simple at least in theory).

In any case, even without virtual method support the Python wrappers
IMNSHO are the most complete scripting option for VTK.

 - David

--
  David Gobbi, MSc                       dgobbi at irus.rri.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Sun, 3 Feb 2002, Benjamin Tai wrote:

> Hi,
>
> I am wondering how complete is VTK extended with Python?
>
> My biggest concern is the following:
>
> Python is virtual by default. It has no declaration.
> On the other hand, the core of VTK is implemented in C++. If I declare a
> C++ function with input argument of type baseclass, the method call
> would then be able to accept instance of baseclass and derived class.
>
> How is this dealt with when extending VTK with Python? As Python
> extension API is written in C.
> What is used for the wrapper generator: yacc, swig, py_cpp, or
> combination of the tools mentioned or not?
>
> Any comments would be appreciated.
>
>
> Ben
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list