[vtkusers] wxPython & VTK: How to Destroy wxVTKRenderWindow without errors?

Kenneth Evans, Jr. evans at aps.anl.gov
Sun May 11 13:12:43 EDT 2008


Charl,

I have looked at this some more and also tried to get the cone6.py tutorial
to work.

1. The problem is that wxVTKRenderWindowInteractor doesn't seem to have a
way to set the vtkRenderWindow.  In the cone6.py code block:

# The vtkRenderWindowInteractor class watches for events (e.g., keypress,
# mouse) in the vtkRenderWindow. These events are translated into
# event invocations that VTK understands (see VTK/Common/vtkCommand.h
# for all events that VTK processes). Then observers of these VTK
# events can process them as appropriate.
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

There is no SetRenderWindow() if you use wxVTKRenderWindowInteractor.

2. Using the cone6 tutorial with this line commented out and printing what
is returned by the shutDownVTK() method I listed in the last message (which
is pretty much what you suggested), I find:

self.ren.GetRenderWindow() and self.renWin.GetRenderWindow() are the same
object (as I expected).  self.renWin.GetRenderWindow() is a different
object.

3.  This lack of a way to change the RenderWindow is also why you can't use:

wxRWI.SetRenderWindow(None)

as you suggested.

4. Perhaps the best question to ask is how do you get the cone6 tutorial to
work with WX, given that is missing SetRenderWindow?

BTW the first part of your solution _did_ solve the problem with the
vtkWin32OpenGLRenderWindow error.  I guess I am moving on to the next
problem.  Perhaps it should be a different topic, although it came up as a
result of your proposed solution.

Thanks for the help,

        -Ken





More information about the vtkusers mailing list