PDA

View Full Version : manually set mouse cursor position


sskalicky
08-17-2018, 09:28 AM
Hello,

I'm designing an experiment where the user picks an object with the mouse to initiate a trial. I'd like to reset the mouse cursor to the center of the screen before the start of a new trial, but I can't seem to find a way to set the position. Any help?

Jeff
08-18-2018, 08:21 AM
Here's some example code:

import viz
import vizact
import win32api

viz.go()
viz.addChild('piazza.osgb')

def setCursorCenter():
win32api.SetCursorPos((400,300))

vizact.onkeydown(' ',setCursorCenter)

sskalicky
08-20-2018, 06:41 AM
Many thanks Jeff!