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">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</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>
&lt;<a href="mailto:garyfallidis@gmail.com">garyfallidis@gmail.com</a>&gt; wrote:<br>
&gt; Dear vtk users,<br>
&gt;<br>
&gt; I am getting the following error for some time using python-vtk with<br>
&gt; libvtk5.4 in ubuntu 10.10<br>
&gt;<br>
&gt; X Error of failed request: BadRequest (invalid request code or no such<br>
&gt; operation)<br>
&gt; Major opcode of failed request: 0 ()<br>
&gt; Serial number of failed request: 30<br>
&gt; Current serial number in output stream: 32<br>
&gt;<br>
&gt; This crashing error comes randomly usually after I have executed the<br>
&gt; following function for a few times.<br>
&gt;<br>
&gt; def show(ren,title=&#39;dipy.viz.fvtk&#39;,size=(300,300),png_magnify=1):<br>
&gt;     &#39;&#39;&#39; Show window<br>
&gt;     &#39;&#39;&#39;<br>
&gt;<br>
&gt;     ren.ResetCamera()<br>
&gt;     window = vtk.vtkRenderWindow()<br>
&gt;     window.AddRenderer(ren)<br>
&gt;     window.SetWindowName(title)<br>
&gt;     window.SetSize(size[0],size[1])<br>
&gt;     style=vtk.vtkInteractorStyleTrackballCamera()<br>
&gt;     iren = vtk.vtkRenderWindowInteractor()<br>
&gt;     iren.SetRenderWindow(window)<br>
&gt;     iren.SetPicker(picker)<br>
&gt;<br>
&gt;     def key_press(obj,event):<br>
&gt;<br>
&gt;         key = obj.GetKeySym()<br>
&gt;         if key==&#39;s&#39; or key==&#39;S&#39;:<br>
&gt;             print(&#39;Saving image...&#39;)<br>
&gt;             renderLarge = vtk.vtkRenderLargeImage()<br>
&gt;             renderLarge.SetInput(ren)<br>
&gt;             renderLarge.SetMagnification(png_magnify)<br>
&gt;             renderLarge.Update()<br>
&gt;             writer = vtk.vtkPNGWriter()<br>
&gt;             writer.SetInputConnection(renderLarge.GetOutputPort())<br>
&gt;             writer.SetFileName(&#39;fvtk.png&#39;)<br>
&gt;             writer.Write()<br>
&gt;             print(&#39;Look for fvtk.png in your current working directory.&#39;)<br>
&gt;<br>
&gt;<br>
&gt;     iren.AddObserver(&#39;KeyPressEvent&#39;,key_press)<br>
&gt;     iren.SetInteractorStyle(style)<br>
&gt;     iren.Initialize()<br>
&gt;     picker.Pick(85, 126, 0, ren)<br>
&gt;     window.Render()<br>
&gt;     iren.Start()<br>
&gt;<br>
&gt; I would appreciate very much any help on that issue. Please let me know if<br>
&gt; you have any ideas.<br>
&gt;<br>
&gt; Best wishes,<br>
&gt; Eleftherios<br>
</div></div></blockquote></div><br>