I have a python script that uses vtk to launch a vtk window to visualize an object . This window is created and launched by a function and this function is assigned to a thread . I’m launching another function that will take information from the camera i the vtk window and write it to a text file. This function is also assigned to another thread . From the main() i’m trying to launch the two threads in parallel. The problem is that when i launch the vtk window function in a thread and then launch the other function in another thread , the vtk thread blocks everything (in the sense that code after this doesn’t run) and when i close the vtk window the code after it continues.
When testing different things i discovered that this function blocks everything :
Have you got a solution for that ??
Please clarify what you want to achieve.
You want to do async tasks?
You can do this by launching ParaView from *.pvsm.
I’ve found a solution but i don’t know how to implement it.
I found this funtion : renderWindowInteractor.AddObserver(‘TimerEvent’, CallBack.writer)
With this observer i can catch different events .This example works fine when i launch from pyCharm with vtk because it creates a Window that i can interact with. The code i’m talking about is this:
cb = ReaderWriterCallback()
cb.actor = actor
timerId = renderWindowInteractor.CreateRepeatingTimer(100)
# start the interaction and timer
As you see in this example , the Event is Timer , but the problem is that when i try to
on paraview , it doesn’t recognize because it’s not a paraview function . In other words i want to interact with the paraview Render View on paraview and not vtk GUI. For example i would like to detect MouseEvents in paraview but it doesn’t work .