psychopy.org | Reference | Downloads | Github

Mouse click in one routine triggers mouse.isPressedIn in a subsequent routine

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Mac OS
PsychoPy version: 2021.2.3.
Standard Standalone? (y/n) Y
**What are you trying to achieve?

Upon pressing a mouse in my first routine, the function if mouse.isPressedIn(button): gets triggered in a subsequent routine. Also, print(mouse.getPressed()) returns [1,0,0] in this second routine, which it should’t be. The mouse click buffer should reset in each new routine. I am trying to force PsychoPy to reset the buffer of clicks to [0,0,0] so it doesn’t trigger the if function in the second routine.
Thanks everyone!

Hi There!

Thanks for reporting this - OK to check this out more, is the onset of the mouse component in both routines 0? if so, does starting the mouse a little after the 0 timepoint change the behaviour?

Thanks,
Becca

Hi, thanks for your response! Yes, the start is set at 0.0. I tried changing it to 0.5 but it didn’t do anything.

OK thanks for trying - please could you share a minimal demo .psyexp of the problem - then I can check out the flow

Thanks!
Becca

Sorry Becca, I didn’t have time to make a demo, but to everyone out there with the same problem, I figured out a workaround - In order to reset the “isPressedIn” value, I added another routine that contains only my background and nothing else and set the duration to 0.2 sec. This new routine goes between the two routines where the value of isPressedIn didn’t reset previously.