MCPcopy Create free account
hub / github.com/Kitware/VTK / SetPythonObject

Method SetPythonObject

Rendering/PythonContext2D/vtkPythonItem.cxx:121–145  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

119
120//------------------------------------------------------------------------------
121void vtkPythonItem::SetPythonObject(PyObject* obj)
122{
123 vtkPythonScopeGilEnsurer gilEnsurer;
124
125 if (!obj)
126 {
127 return;
128 }
129
130 Py_XDECREF(this->Object);
131
132 this->Object = obj;
133 Py_INCREF(this->Object);
134
135 const char* mname = "Initialize";
136 VTK_GET_METHOD(method, this->Object, mname, /* no return */)
137
138 PyObject* vtkself = VTKToPython(this);
139 vtkSmartPyObject args(PyTuple_Pack(1, vtkself));
140 Py_DECREF(vtkself);
141
142 vtkSmartPyObject result(PyObject_Call(method, args, nullptr));
143
144 CheckResult(mname, result);
145}
146
147//------------------------------------------------------------------------------
148bool vtkPythonItem::Paint(vtkContext2D* painter)

Callers 2

testPythonItemMethod · 0.45

Calls 2

VTKToPythonFunction · 0.70
CheckResultFunction · 0.50

Tested by 1

testPythonItemMethod · 0.36