psychopy.org | Reference | Downloads | Github

Issue with visual.GratingStim in a loop

I created a texture with visual.GratingStim and I would like to change its size at every frames in a loop.
When in my loop I write the following lines it works (my texture increases in size):

  • xx += 100
  • patch = visual.GratingStim(win, tex=img_new, size=(xx,xx), units=‘pix’, mask=‘circle’, interpolate=True, autoLog=True)
  • patch.draw()
    But I’m running at 240fps and it is too costly in calculation.

While when I create my texture before my loop and then I write in my loop:

  • patch.size += (100,100)
  • patch.draw()

It does not work.

Would you have any thoughts?

Try

xx += 100
patch.size = (xx,xx)
patch.draw()

Thanks! something happened at least but not what I wanted. It multiplies the texture on x- and y- axes but what I would like is to zoom in or out on the texture. Any thoughts?

Maybe you should be addressing patch.sf

https://www.psychopy.org/api/visual/gratingstim.html