[open] Recentre the mouse in each loop iteration
I have a custom form, generated with a Python inline script, that runs as the main part of my loop. In each iteration, the mouse position does not change. I would like it to reset to the centre of the screen (when in fullscreen mode) on each iteration.
I've tried this (where mouse has been imported):
myMouse = mouse(exp)
myMouse.set_pos((0,0))
...I also tried myMouse.set_pos(pos=(exp.get("width")/2, exp.get("height")/2), per the answer to this question.
Neither of them worked (using the Legacy backend)... Any ideas?
Thanks;
C
Comments
(n.b., the
set_poscall does work when running in windowed mode.)...Following a short discussion on StackOverflow, I tried to see what
get_poswas returning both before and after the call toset_pos. Weirdly,get_posis returning the expected coordinates, it's just that the actual pointer on the screen doesn't move.To add to the weirdness: My experiment consists of two tasks. The task in question is exhibiting this non-resetting position behaviour in fullscreen mode; however, the other task does reset the mouse position in every loop iteration (without me explicitly telling it to). The other task is not that different, in terms of structure; it just has an extra Python script that draws to the canvas. I tried adding a similar item to the non-resetting task -- which just shows and clears the canvas -- but all that did was make the screen flash and the pointer still doesn't move!
This forum post suggests that playing with
set_visiblewill have an effect. So far, all this has done for me is make the pointer flash briefly. (That said, I've been usingmyMouse.set_visible, rather thanself.mouse.set_visible. I don't suppose that will make a difference, but I'll try the latter this evening...)Thanks;
C
Hi,
Setting the mouse position is a tricky business. As far as I can tell, it works differently on different system--but rarely as expected.
I cannot say much more than I already did in the forum post that you're linking to. But what you could try is playing with the back-end settings. For example, what happens if you disable/ enable double buffering or hardware surface?
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
No luck, I'm afraid... Thanks, all the same