Button component registers clicks from previous routine

Windows 10
Psychopy v2022.2.4

Instead of using a keyboard component to advance to the next routine, sometimes I use a button component. However, on my setup, the component does not register individual clicks but rather a constant stream of “mouse down”-events (or so I think). This is a problem, because it means that (when the button terminates the current routine) on the very first frame of the next routine it is determined that the mouse button is still “down” and if the buttons of those routines are placed at the same location the “new” button is triggered instantly and this new routine is terminated as well.
A very simple work around is to just set the starting time of every button component to something like 0.5 so that individuals have the time to release the mouse button.
A more elaborate way is to define a boolean and only set it to true when the mouse is released.

However, my question is: Is there something I am missing, and I don’t have to use those work arounds?
It bugs me as I am only creating “template” experiments which are supposed to be modified and adapted by other people (that don’t have any background in programming and have only revived a very brief intro to psychopy). Those work arounds are not intuitive and are rather confusing to the guys adapting my experiments to their use cases. Thats why I am trying to minimize the use of any code components.
I’m only wondering because it seems that on a mac OS the button actually does register individual clicks right out of the box (which makes so much more sense to me). So, it might be windows specific thing?

Best,
umb

Hi @umb, also just a workaround (so not really answering your question) but maybe the most parsimonious one: Set the “start” field of the button to “condition” and use the condition mouse.getPressed()[0] == False. This way the button is only initiated if the mouse is not pressed (anymore).

3 Likes

What I tend to do is make sure my buttons are not in the same position. However, I think @ajus has a potentially very good solution (especially if it works online without modification).

That’s a neat work around, thanks.
But there should be some kind of option for the button component that enables this behaviour on its own - as I am convinced that this is an absolute standard use case for buttons.

Is it a sensible thing to request a feature at github?
Because I am pretty sure I saw it working on Mac OS (although I cannot confirm it right now because I have no access to Macs).
Because in this case I’d want to report a bug for Windows.