[vtkusers] python: setting object input to None
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Tue Feb 19 04:27:17 EST 2002
>>>>> "CPB" == Charl P Botha <c.p.botha at its.tudelft.nl> writes:
CPB> Dear VTKers, In C++, if I want to "disconnect" a process
CPB> object from its input, I do something like:
CPB> TheProcessObject->SetInput(NULL)
CPB> However, when I try this in Python:
CPB> TheProcessObject.SetInput(None) I get the following error
CPB> message: "ValueError: method requires a VTK object", which is
CPB> valid.
CPB> So, how should I go about disconnecting a process object from
CPB> its input?
Which version of VTK is this? This works when you use the VTK 4.0 cvs
tree.
In [1]: from vtk import *
In [2]: m = vtkPolyDataMapper()
In [3]: m.SetInput(None)
In [4]: c = vtkContourFilter()
In [5]: c.SetInput(None)
In [6]: class A:
...: pass
...:
In [7]: c.SetInput(A())
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
?
ValueError: method requires a VTK object
In [8]: vtkVersion().GetVTKSourceVersion()
Out[8]= 'vtk version 4.1.1, vtk source $Revision: 1.1151 $, $Date: 2002/02/16 03:45:03 $ (GMT)'
Which illustrates that SetInput(None) definitely works and ValueErrors
do occur in other situations.
prabhu
More information about the vtkusers
mailing list