<div class="gmail_quote">On Mon, May 24, 2010 at 8:52 AM, Eric E. Monson <span dir="ltr">&lt;<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hello,<br>
<br>
I was trying to figure out something with the 2D API, but I&#39;m having trouble with the mouse events. In this simple example, the block I create doesn&#39;t seem to actively respond to mouse events. Really it does, but they&#39;re just not rendered until I spin the scroll wheel on my mouse, and then you see the block suddenly move or turn red or resize as it&#39;s supposed to...<br>


<br>
#======================<br>
#!/usr/bin/env python<br>
import vtk<br>
<br>
cView = vtk.vtkContextView()<br>
cItem = vtk.vtkBlockItem()<br>
cItem.SetLabel(&#39;x&#39;)<br>
cItem.SetDimensions(60,100,60,30)<br>
cView.GetScene().AddItem(cItem)<br>
<br>
iren = cView.GetRenderWindow().GetInteractor()<br>
iren.Initialize()<br>
iren.Start()<br>
#======================<br>
<br>
Can anyone point me to what&#39;s going wrong? I&#39;m sure most things work fine since I use the parallel coordinates charts almost every day which are based on the same 2D API, but I must be leaving out some step.<br>
<br></blockquote><div>It is tough for the scene to know when to re-render. I also wanted to allow batch operations before rendering again. You want to call SetDirty(true) on the context scene. This sets an ivar in the scene, and when mouse interaction is done it will trigger a render.</div>

<div><br></div><div>It was pointed out to me that you should never unset a scene to dirty. And so the bool argument will probably disappear/be ignored.</div><div><br></div><div>Hope that helps.</div><div><br></div><div>Marcus</div>

</div>