[vtkusers] checking to see if a vtkRenderWindow still exists from python

Jiro Inoue inoue at cs.queensu.ca
Wed Nov 28 16:36:12 EST 2001


Disclaimer: I don't use python, so I can't claim certainty on this.


You can link observers (vtkCommand objects) to vtkObjects so that when
certain events are invoked, your observer is notified. In c++, I derive a
subclass  from vtkCommand to create the proper observer - i'm not sure about
python, but it might be worth taking a look.


-Jiro



On Wed, 28 Nov 2001, John Hunter wrote:

> Date: Wed, 28 Nov 2001 15:09:09 -0600
> From: John Hunter <jdhunter at ace.bsd.uchicago.edu>
> To: VTK Users <vtkusers at public.kitware.com>
> Subject: [vtkusers] checking to see if a vtkRenderWindow still exists
>     from python
>
>
> I am writing a matlab style plot interface to vtkXYPlot in python and
> want to emulate the
>
> figure(1)
>
> figure(2)
>
> behavior in matlab.  These functions create a new figure window if it
> doesn't exist and will make the indicated figure current if it does.
>
> I am storing instances of vtkRenderWindows by figure number to
>  implement this behavior.  I need to know if the window has been
>  closed by the user, and I am trying to make this independent of the
>  type of render window used.
>
> Is there a way to find out if a render window is still available?
>
> I tried
>
>   try:
>     #__vtkPlotInfo is a global object to manage state
>     __vtkPlotInfo.get_current_renwin().Render()
>   except:
>     #the window doesn't exist
>     ...do something...
>
> But this aborted execution; ie there was no exception thrown.
>
> Any suggestions?  I also have access to the renderers and vtkXYPlot
> objects.
>
> Thanks,
> John Hunter
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list