I've been trying to set up python to work with vtk for the past three days but I'm stuck.<br><br>Under Windows nothing seems to work...I can compile vtk after I've turned on the shared lib options and the python wrapping but neither vtkpython nor python work (I've tried all the possible solutions I found on various mailing lists but with no success). So i decided to try on linux (btw I've got Ubuntu)...things seemed to go pretty well...I've compiled python 2.5.2, then installed Cmake. Using Cmake I changed the compiling option for vtk turning on the shared library option and the python wrappings..make & make install..went for a couple of coffes...set all the environment variables..launched python with an example I found on internert...nothing.<br>
<br>By chance I discovered that the actual module I have to lode is not called libVTKCommonPython but libvtkCommonPython...importing this module works fine and also libvtkGraphicsPython is imported (I checked by doing >> import sys >> print sys.modules). The thing is if I try to type in the following line (ren=vtkRenderer()) I get a message saying<br>
<br>NameError: name 'vtkRenderer' is not defined<br><br>However if I type in cone=vtkConeSource() everything works. I think there must be something wrong with some of the libraries.<br><br>I tried to import from libvtkRendereingPython but I got this message:<br>
<br>ImportError: /usr/lib/libvtkRenderingPythonD.so.5.0: undefined symbol: _ZN16vtkGL2PSExporter24SetGlobalLineWidthFactorEf<br><br>That's pretty strange since I didn't enable the GL2PS support...<br><br>Anybody can help?<br>
<br>Thanks<br><br>Angelo<br><br>P.S. here's the script I used for testing<br><br><br><font color="#990000">#! /usr/bin/python</font>
<p><font color="#990000"># load VTK extensions</font>
<br><font color="#3366ff">from</font> libVTKCommonPython <font color="#3366ff">import</font>
*
<br><font color="#3366ff">from</font> libVTKGraphicsPython <font color="#3366ff">import</font>
*
</p><p><font color="#990000"># create a rendering window and renderer</font>
<br>ren = vtkRenderer()
<br>renWin = vtkRenderWindow()
<br>renWin.AddRenderer(ren)
<br>renWin.SetSize(300,300)
</p><p>iren = vtkRenderWindowInteractor()
<br>iren.SetRenderWindow(renWin)
</p><p><font color="#990000"># create an actor and give it cone geometry</font>
<br>cone = vtkConeSource()
<br>cone.SetResolution(8)
<br>coneMapper = vtkPolyDataMapper()
<br>coneMapper.SetInput(cone.GetOutput())
<br>coneActor = vtkActor()
<br>coneActor.SetMapper(coneMapper)
</p><p><font color="#990000"># assign our actor to the renderer</font>
<br>ren.AddActor(coneActor)
</p><p><font color="#990000"># enable user interface interactor</font>
<br>iren.Initialize()
<br>iren.Start()</p><br>