canvas copy
Hi all,
I'm working on a script within opensesame for a gaze contingent display. For simplicity, lets just say a small circle that is drawn on the current gaze position. Now the canvas that the subject will be searching doesn't change (other than the circle), but it does consist of many randomly placed elements, so I would prefer not to redraw the canvas from scratch every time I redraw the gaze contingent circle. My first thought was to draw the full set of search elements in the prepare phase, then, in the run phase repeatedly grab a copy of that canvas and draw the circle at gaze position before showing it. Rinse, repeat.
so something like
frontcanvas = canvas()
While....:
frontcanvas.copy(backpreparedcanvas)
x,y = sample()
frontcanvas.circle(x,y)
frontcanvas.show()
Now this logic seems to work visually, but I get a lot of errors and freezing at the end of experiment. This makes me think that copy() may not be behaving like think it is. My first guess would be that the memory for many frontcanvas objects is not being released, but there doesn't seem to be an explicit way to release it.
Is there a better way that I am missing?
Cheers,
Joe
Comments
Hi @joeymac ,
I'm not entirely sure why this approach would lead to freezing, but there's definitely a better way. You can assign a name to the circle element on the canvas:
And then later you can change the coordinates dynamically:
See also:
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks Sebastian! I was (incorrectly) assuming that canvas was a raster image after items were drawn to it.
Joe