<div dir="ltr"><div>According to the tutorials and example code, you can create a vtkCallbackCommand() object and then call SetCallback on it with a callback function, as in:</div><div><br></div><div>
<pre class="gmail-de1"> vtkSmartPointer<span class="gmail-sy1"><</span>vtkCallbackCommand<span class="gmail-sy1">></span> keypressCallback <span class="gmail-sy1">=</span>
vtkSmartPointer<span class="gmail-sy1"><</span>vtkCallbackCommand<span class="gmail-sy1">></span><span class="gmail-sy4">::</span><span class="gmail-me2">New</span><span class="gmail-br0">(</span><span class="gmail-br0">)</span><span class="gmail-sy4">;</span>
keypressCallback<span class="gmail-sy2">-</span><span class="gmail-sy1">></span>SetCallback <span class="gmail-br0">(</span> func <span class="gmail-br0">)</span><span class="gmail-sy4">;</span></pre>
</div><div>However, when I try this with Python, I get<i> 'vtkCommonCorePython.vtkCallbackCommand' object has no attribute 'SetCallback'</i>. I'm using vtk 8:</div><div><br></div><div>
<div style="color:rgb(51,51,51);background-color:rgb(245,245,245);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(122,62,157)">def</span><span style="color:rgb(51,51,51)"> </span><span style="color:rgb(170,55,49);font-weight:bold">onClick</span><span style="color:rgb(119,119,119)">():</span></div><div><span style="color:rgb(51,51,51)"> </span><span style="color:rgb(170,55,49);font-weight:bold">print</span><span style="color:rgb(119,119,119)">(</span><span style="color:rgb(119,119,119)">"</span><span style="color:rgb(68,140,39)">Hello, World!</span><span style="color:rgb(119,119,119)">"</span><span style="color:rgb(119,119,119)">)</span></div><br><div><span style="color:rgb(51,51,51)">onClickCallback </span><span style="color:rgb(119,119,119)">=</span><span style="color:rgb(51,51,51)"> vtk</span><span style="color:rgb(119,119,119)">.</span><span style="color:rgb(51,51,51)">vtkCallbackCommand</span><span style="color:rgb(119,119,119)">()</span></div><div><span style="color:rgb(51,51,51)">onClickCallback</span><span style="color:rgb(119,119,119)">.</span><span style="color:rgb(51,51,51)">SetCallback</span><span style="color:rgb(119,119,119)">(</span><span style="color:rgb(51,51,51)">onClick</span><span style="color:rgb(119,119,119)">)</span></div></div>
<br></div></div>