| Reference | Downloads | Github

Mouse not working in psychopy window

I’m reposting because I have a bit more info (old post linked below).

My problem is that most of the time, mouse clicks are missed. I just tried running the demo and found that, while I can see the cursor move, the “buffer zone” that should follow the cursor will typically stop following the mouse for 1-3s. During this time, mouse clicks are completely missed and the mouse cursor is not registered as being near or in the shape. Even when there are issues in the psychopy experiment window, I can click on the coder window as well as anywhere else on my desktop without an issue.

None of these issues occur on my own Mac laptop or my office Mac desktop, only on PC (running Windows 10 enterprise).

Our IT guy has no idea what the issue might be. I’m hoping I can get pointed in the right direction here.

Thank you,

@Michael , you found my post on stackOverflow. Only new piece of information is that when there are issues with the mouse, the computer is also slow to register a keyboard press—I guess keyboard presses go to some buffer but mouse events do not? In any case, I’ll reiterate, there’s no noticeable slow down in anything outside of the experiment window.

Hi @David_Martinez,

I had the same mouse problem during a gaze-contingent paradigm that I was trying to run. My big issue was using mouse.isPressedIn() and a psychopy.event mouse object. Instead, I would try using a psychopy.ioHub mouse device and the following:

# start io hub process 
io = launchHubServer()

# create mouse devices
mouse = io.devices.mouse
# ensure showing of the mouse cursor

# check that mouse is connected
if io.getDevice('mouse') is None:
    print ("Mouse is not connected")
    print("Mouse is connected")

# what ever the rest of your code is

# sample every frame
while True:
    # check states of all mouse buttons, but can specify to only one
    if True in (x for x in mouse.getCurrentButtonStates()): 
        # if mouse is pressed then iterate through shapes
        for rectangle in polygonList2:
            # if mouse position (first return from .getPositionAndDelta) is contained in rectangle
            if rectangle.contains(mouse.getPositionAndDelta()[0]:
                # then do your stuff

I’m not sure mouse.getPositionAndDelta() is still the correct argument, but an easy way to find out is just to run the mouse for a bit:

mouse.reporting = True

Play with it a bit to let it gather some data, then collect that data:

foo = mouse.getEvents()

Then print the dictionary to see how positions are reported for the ioHub mouse and use that to get the position attribute.

Good luck!