[vtkusers] wxPython & VTK: How to Destroy wxVTKRenderWindow without errors?
Charl Botha
c.p.botha at tudelft.nl
Sun May 11 18:12:42 EDT 2008
On Sun, May 11, 2008 at 7:12 PM, Kenneth Evans, Jr. <evans at aps.anl.gov> wrote:
> 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:
>
> There is no SetRenderWindow() if you use wxVTKRenderWindowInteractor.
Hmm, did you double-check? I see the following:
>> print rwi
<vtk.wx.wxVTKRenderWindowInteractor.wxVTKRenderWindowInteractor; proxy
of <Swig Object of type 'wxWindow *' at 0xcb00948> >
>> print rwi.SetRenderWindow
<built-in method SetRenderWindow of vtkobject object at 0x0D07F350>
There is some swig-magic going on, so you don't see it in dir() calls
and in introspection-based autocompletion, but it's there. You just
need to call it. :)
That being said: under normal circumstances, you should never need to
call this, except at shutdown, and even then it's probably not really
necessary. The wxVTKRWI creates its own RenderWindow.
> 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.
This statement is self-contradictory. What exactly do you mean here?
> 3. This lack of a way to change the RenderWindow is also why you can't use:
>
> wxRWI.SetRenderWindow(None)
>
> as you suggested.
I've been using this for quite a long time. Could you re-check that
you can't invoke that method on the wxVTKRWI?
> 4. Perhaps the best question to ask is how do you get the cone6 tutorial to
> work with WX, given that is missing SetRenderWindow?
As explained right up above, the wxVTKRWI creates its own
vtkRenderWindow. Only thing you have to do is to create a vtkRenderer
and then install it as follows:
ren = vtk.vtkRenderer()
rwi.GetRenderWindow().AddRenderer(ren)
Good luck!
Charl
More information about the vtkusers
mailing list