Collecting RTs from mouse click (left vs. right mouse button), and show a visual feedback

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

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2021.2.3
Standard Standalone? (y/n) Yes
**What are you trying to achieve?: I just need a simple task in which participants have to press one button of the mouse (e.g., the left one) if “1” appears, and another button (e.g., the right one) if “2” appears. I want to store RTs (from the onset of the number and the “click” on the mouse), and also I want to display a feedback, saying: “no response”, “correct”, or “error”.

**What did you try to make it work?: I tried to use the code component within the Builder

What specifically went wrong when you tried that?:
Apparently, everything works well, but the feedback that I get is always the same. Moreover, I cannot store RTs properly. My code experiment, and the excel file with conditions, are attached. Many thanks in advance! MD
mouse.psyexp (16.8 KB)
stimuli.xlsx (9.4 KB)

Hello MD84,

try the following code in place of your code.

button = mouse.getPressed()
slow = [0,0,0]

if button == slow:
elif button[0] == 1 and corr == 0:
elif button[2] == 1 and corr == 2:

get.Pressed returns a 3-item list indicating whether or not buttons 0,1,2 are currently pressed.

Best wishes Jens

1 Like

Hi there,

Linking this tutorial for feedback from the mouse as it might be helpful. Extending Builder with code — Workshops for PsychoPy 2022 2022 make sure to have your mouse > data stored to “on click”

1 Like

Thank you both, I’ve solved my issues.