Give feedback to mouse response


I am trying to provide feedback after each trial. However, instead of having participants respond using keyboard, I have them give responses using mouse click. I understand that there is a demo regarding giving feedback to key responses, but I am wondering if it is doable to give feedback to mouse response. If so, how should I do it? Thank you.

You can definitely do it. The only difference would be how you categorize responses. What constitutes your mouse response? Are you interested in whether the participant clicked in a certain area? Do you just want to give a correct/incorrect feedback?

Hi Lukas,

Thank you for your response. I am doing a version of the WCST and so I would like to give a correct/incorrect feedback depending on the pictures participants clicked in.

You can check if the mouse was pressed in an ImageStim with a code component:

# replace myMouse with the name of your mouse component
# replace myImage1 and myImage2 with the names of your image components
# replacePathToImg2 with the name of the column with the image 
# paths in your conditions file
if myMouse.isPressedIn(myImage1): 
    imgClicked = pathToImg1
elif myMouse.isPressedIn(myImage2):
    imgClicked = pathToImg2

Then, in a feedback routine, you can check which image was clicked:

# replace pathToCorrectAnsw with the name of the column which defines 
# the correct answer in your conditions file
if imgClicked == pathToCorrectAnsw:
    feedbackTxt.text = 'Your answer was correct.'
    feedbackTxt.text = 'Not even close.'

Disclaimer: I haven’t tested the code, and I don’t know whether it will work for an online study.

1 Like

Thank you so much for your help! I am going to try it and let you know.

1 Like