[vtkusers] vtkRenderWindowInteractor.Start() blocks unrelated threads?
Martin Ling
martin-vtk at earth.li
Thu Feb 1 08:43:31 EST 2007
Hi,
The following python script sets up a simple VTK pipeline, then launches
a separate thread which does not interact with any of the VTK objects -
it just prints to standard output.
When run, UPDATE 0 is printed, but once the Start() method on the
RenderWindowInteractor is called, the second thread stops. Only when the
render window is closed does the other thread start printing again.
This occurs under both VTK 4.2 on Win32 and VTK5.0 on Linux.
What's going on?
The background is that I have some realtime data capture that I'd like
to feed into the pipeline, whilst having some simple controls for the
display. Is there some other approach I can take that doesn't involve
starting an interactor?
Thanks for any help,
Martin
---
from vtk import *
import time
import threading
text = vtkTextActor()
ren = vtkRenderer()
ren.AddActor2D(text)
renWin = vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.Initialize()
def runUpdate():
i = 0
while (True):
print "UPDATE ", i
i += 1
time.sleep(1)
updateThread = threading.Thread(target=runUpdate)
updateThread.start()
iren.Start()
Martin
More information about the vtkusers
mailing list