Hi David,<br><br>Are you suggesting, that I need to catch when window_exit is pressed and remove the renderer from the window then or is there a different way?<br><br>Thank you,<br>Eleftherios<br><br><br><div class="gmail_quote">
On Tue, Jul 19, 2011 at 5:46 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Eleftherios,<br>
<br>
You are re-using the vtkRenderer but constantly re-creating<br>
the vtkRenderWindow and the interactor? You should call<br>
window.RemoveRenderer(ren) to disconnect the window from<br>
the renderer once you are finished with the window. I suspect<br>
that, because you are not doing this, you are ending up with a<br>
whole bunch of render windows that are closed but not destroyed,<br>
because they are still associated with the renderer.<br>
<font color="#888888"><br>
- David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Tue, Jul 19, 2011 at 10:21 AM, Eleftherios Garyfallidis<br>
<<a href="mailto:garyfallidis@gmail.com">garyfallidis@gmail.com</a>> wrote:<br>
> Dear vtk users,<br>
><br>
> I am getting the following error for some time using python-vtk with<br>
> libvtk5.4 in ubuntu 10.10<br>
><br>
> X Error of failed request: BadRequest (invalid request code or no such<br>
> operation)<br>
> Major opcode of failed request: 0 ()<br>
> Serial number of failed request: 30<br>
> Current serial number in output stream: 32<br>
><br>
> This crashing error comes randomly usually after I have executed the<br>
> following function for a few times.<br>
><br>
> def show(ren,title='dipy.viz.fvtk',size=(300,300),png_magnify=1):<br>
> ''' Show window<br>
> '''<br>
><br>
> ren.ResetCamera()<br>
> window = vtk.vtkRenderWindow()<br>
> window.AddRenderer(ren)<br>
> window.SetWindowName(title)<br>
> window.SetSize(size[0],size[1])<br>
> style=vtk.vtkInteractorStyleTrackballCamera()<br>
> iren = vtk.vtkRenderWindowInteractor()<br>
> iren.SetRenderWindow(window)<br>
> iren.SetPicker(picker)<br>
><br>
> def key_press(obj,event):<br>
><br>
> key = obj.GetKeySym()<br>
> if key=='s' or key=='S':<br>
> print('Saving image...')<br>
> renderLarge = vtk.vtkRenderLargeImage()<br>
> renderLarge.SetInput(ren)<br>
> renderLarge.SetMagnification(png_magnify)<br>
> renderLarge.Update()<br>
> writer = vtk.vtkPNGWriter()<br>
> writer.SetInputConnection(renderLarge.GetOutputPort())<br>
> writer.SetFileName('fvtk.png')<br>
> writer.Write()<br>
> print('Look for fvtk.png in your current working directory.')<br>
><br>
><br>
> iren.AddObserver('KeyPressEvent',key_press)<br>
> iren.SetInteractorStyle(style)<br>
> iren.Initialize()<br>
> picker.Pick(85, 126, 0, ren)<br>
> window.Render()<br>
> iren.Start()<br>
><br>
> I would appreciate very much any help on that issue. Please let me know if<br>
> you have any ideas.<br>
><br>
> Best wishes,<br>
> Eleftherios<br>
</div></div></blockquote></div><br>