Getting started with pyvtk

Robert Kern robert.kern at gmail.com
Thu May 1 17:45:51 EDT 2008


Peter Pearson wrote:
> I'm trying to get started with pyvtk, the Python interface
> to the Visualization Toolkit, but there's obviously
> something important that I haven't figured out after an
> embarrassingly long morning of googling around.  When I run
> sample pyvtk code (example1.py, from
> http://cens.ioc.ee/cgi-bin/viewcvs.cgi/python/pyvtk/examples/example1.py),
> nothing graphical happens, but some text files appear named
> example1.vtk and example1b.vtk.  Guessing that I need to
> feed one of these to vtk, I tried "vtk <example1.vtk" and
> "vtk example1.vtk", but those result in (different) error
> messages that I think mean example1.vtk is not the language
> that vtk expects.  Simply running "vtk" (apparently 4.0)
> gets a prompt that has no help command, and "man vtk" just
> tells me it's like "wish", and "man wish" doesn't address
> what to do with a vtk file.
> 
> What key piece am I missing?

pyvtk is not the Python interface to VTK. It is for the creation of VTK files. 
The vtk(1) command is a Tcl shell with the VTK libraries loaded (I believe). 
Read the VTK documentation for information on the Tcl interface if you really 
want to use it. The Python interface is also included in the VTK sources, 
although it might not have been built on your machine. You have to enable it 
when you build VTK itself. The Python interface is essentially the same as the 
C++ interface. There are Python examples in the VTK source tree.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list