[vtkusers] How to use vtkinteraction in Python
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Tue Sep 24 05:48:49 EDT 2002
>>>>> "yqtan" == "yqtan" <yqtan at msn.com> writes:
yqtan> I want to write a "Mace.py" in python. When I "import
yqtan> vtkinteractor", the python interpreter reprorts
yqtan> "ImportError: No module named vtkinteraction". But "import
yqtan> vtk" is OK.
yqtan> I am using Python 2.0, vtk 4.0. "Mace.tcl" could be find at
yqtan> "vtk_src\examples\GUI\Tcl\Mace.tcl" in vtk source code.
There is no module called vtkinteraction. To use an interactor with
Python you need to first pick a GUI toolkit -- lets say you choose
Tkinter. If you want to use a vtkTkRenderWindowInteractor then import
vtk.tk.vtkTkRenderWindowInteractor. This should be inside the
Wrapping/Python/vtk/tk/ directory. If this directory/file does not
exist under VTK 4.0 you should consider using a recent CVS version or
a nightly. You can also use VTK's standard vtkRenderWindowInteractor.
In order to use this you dont need to have Tkinter etc. Simply try
this:
import vtk
rw = vtk.vtkRenderWindowInteractor()
# etc. etc.
cheers,
prabhu
More information about the vtkusers
mailing list