Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Recentre the mouse in each loop iteration

edited August 2015 in OpenSesame

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

  • edited 8:17AM

    (n.b., the set_pos call does work when running in windowed mode.)

  • edited 8:17AM

    ...Following a short discussion on StackOverflow, I tried to see what get_pos was returning both before and after the call to set_pos. Weirdly, get_pos is 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_visible will have an effect. So far, all this has done for me is make the pointer flash briefly. (That said, I've been using myMouse.set_visible, rather than self.mouse.set_visible. I don't suppose that will make a difference, but I'll try the latter this evening...)

    Thanks;
    C

  • edited 8:17AM

    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

  • edited 8:17AM

    No luck, I'm afraid... Thanks, all the same :)

Sign In or Register to comment.