I am working on an animal tracking program with OpenCV. When the animal is recognised, I want to draw some shapes and project them in front of it for a certain number of seconds. For drawing the shapes and projecting them I am using PsychoPy
When I get the animal and call the draw function with PsychoPy, the program freezes until the shape is disappeared. I used the Threading to solve this, but the program stops completely with a system message says "Python quit unexpectedly."
Here is how I am opening the thread:
t = threading.Thread(target=stimulus_controller.draw, args=(stimulus_view, 20))
t.setDaemon(True)
t.start()
where the stimulus_view is an array of the shapes I want to draw, and the 20 is the number of seconds to show the stimulus.
And this is the drawing code:
def draw(stims, time):
trialClock = core.Clock()
while t < time:
t = trialClock.getTime()
for s in stims:
s.draw()
myWin.flip()
It is simple but it keeps stopping unexpectedly!
Thank you very much.