mouse.getPos() doesn't reflect recently set mouse.setPos()

Nice script. Is strangely satisfying seeing one’s mouse movements repeating. Very cool.

I think your diagnosis was correct. Pyglet (not our code!) is updating the mouse but not storing its updated location. We can get around it by doing it ourselves on pyglet’s behalf and I’ve just made that change in PsychoPy here:
https://github.com/psychopy/psychopy/pull/1488/commits/f9fc6706bc76dcab90cba3c6558dc9b291d8fa0c

You could either make that change in your own copy of psychopy or do it in your script. e.g. you could add a function like this:

def moveMouse(x,y):
    mouse.setPos([x,y])
    win.winHandle._mouse_x = x  # hack to change pyglet window
    win.winHandle._mouse_y = y

and then you’d call moveMouse(x,y) in the rest of your script instead of the psychopy function.

This actually solves one part of a post ages ago where @lindeloev, @rob.stone and @porcu.emanuele were battling with the mouse. @lindeloev noticed the issue you mention and now it’s one part of that puzzle that’s fixed. :slight_smile:

cheers,
Jon