[vtkusers] wxPython & VTK: Problem with cone6.py in WX

Kenneth Evans, Jr. evans at aps.anl.gov
Wed May 14 10:01:59 EDT 2008


Hi,

I got it to work with the usual pattern of a vtkRenderWindow and a separate
vtkRenderWindowInteractor (USE_WX = True and USE_INTERACTOR_ONLY =
False in the example).  The idea is to use a regular
vtkRenderWindowInteractor, not a wxVTKRenderWindowInteractor.  

Thus:

  iren = vtk.vtkRenderWindowInteractor()
  iren.SetRenderWindow(renWin)

goes to:

    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin.GetRenderWindow())

instead of my first guess of:

    iren = wxVTKRenderWindowInteractor(frame, wx.ID_ANY)
    iren.SetRenderWindow(renWin.GetRenderWindow())

For some reason it zooms way in when you do this.  I needed to add:

if(USE_WX and not USE_INTERACTOR_ONLY):
  # Reset the camera (Seems to be needed)
  ren1.ResetCamera()

It probably shouldn't change the zoom.

The new version is attached.  It seems to be a more detailed example of how
to use VTK with WX than any I've found elsewhere.  It shows two different
ways.  Any comments or criticism would be appreciated.

        -Ken

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Cone6WX.py
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080514/cc95831e/attachment.txt>


More information about the vtkusers mailing list