Holdin right mouse button down messes with my click counter

I have a Routine where participant is supposed to click with the left mouse button 100 times in a button.

if (mouseA.isPressedIn(textA)) and not mouseDown:
mouseDown = True
razao += 1
elif mouseDown and mouseA.getPressed()[0] == 0:
mouseDown = False

This code used to work just fine, but now I realized that if Participant hold right mouse button, it “clicks” by itself, and a lot faster than manual 100 clicks would take.
This doesn’t happens if participant holds left mouse button.

Thanks in advance,

Try

if (mouseA.isPressedIn(textA)) and not mouseDown:
     mouseDown = True
     razao += 1
elif mouseDown and mouseA.getPressed()[0] and mouseA.getPressed()[1] == 0:
     mouseDown = False
1 Like

That didn’t work
But, you pointed out for the buttons [0, 1, 2] on mouse codes, something I was not paying attention to.

So, now, with the code

if (mouseA.isPressedIn(textA, buttons=[0])) and not mouseDown:
     mouseDown = True
     razao += 1

elif mouseDown and mouseA.getPressed()[0] == 0:
     mouseDown = False

everything looks to be running just fine.

Thank you very much @wakecarter!

1 Like