psychopy.org | Reference | Downloads | Github

Reduce mouse movement speed

Hello,

I am designing an experiment where the subject has to move a mouse along a line (movement is restricted to Y axis only) to reach a stimuli position that has been presented previously. For reasons, the answer position is recorded when the mouse velocity falls beyond a certain threshold (not via click). So if the mouse speed is lowered at the target zone the answer is recorded as correct. My problem here is that the mouse speed is too fast, so I am looking for a way to decreasse the movement speed of the mouse. I tried reducing the sensitivity in the Windows setting and, however it is still much too fast.
Is there a way/code to reduce the mouse speed any further within python/psychopy ?(Some games allow you to allter mousespeed in-game independent of the Windows setting) I am using Python 2.7 (Spyder 3) with pygame and psychopy libraries on Win7 Pro.

Thank you in advance

Hi,
I don’t know whether this is exactly what you are trying to achieve, but you can try the following solution:

from psychopy import visual, event

mywin = visual.Window((800,800), 
        monitor='testMonitor', 
        units='pix',
        fullscr=False)
       
topo = event.Mouse(win=mywin)
speed = 3 # change this parameter to change speed
c = 0
while any(topo.getPressed()) != True:
    if c % speed == 0:
        pos = topo.getPos()
    topo.setPos(pos)
    mywin.flip()
    c += 1

Cheers,
Emanuele