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

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Nov 29 10:22:09 EST 2001


>>>>> "Jiro" == Jiro Inoue <inoue at cs.queensu.ca> writes:

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

Thanks for the tip.  This sounds perfect.  

Unfortunately, I am having some trouble using this in python.  When I
run my test case, I get a NameError 'vtkCommand' is not defined.

>From what I can see by looking through the source code, vtkCommand is
exported in ./common/python/vtkCommandPython.cxx and
libVTKCommonPython.so is in my PYTHONPATH.

But when I try to run

from vtkpython import *

class TestCommand( vtkCommand ):
    def __init__(self):
        vtkCommand.__init__(self)

t = TestCommand()

I get the NameError I mentioned above.  Ditto when I try to derive
from vtkPythonCommand.  I am not sure if this is a problem with my
installation, a bug in the wrapping, or a known omission.

Has anyone used vtkCommand with python in vtk3.2?  When I recursively
grep the *.py examples for vtkCommand or vtkPythonCommand, none of
them match.  

Thanks,
John Hunter



More information about the vtkusers mailing list