psychopy.org | Reference | Downloads | Github

Adding feedback to trial items

I’m attempting to provide feedback to trial items on a Stroop experiment.

I followed the directions on PsychoPy’s website, typing into the Begin Routine tab of the Code component:

if not key_resp.keys :
    msg="Failed to respond"
elif resp.corr:#stored on last run routine
    msg="Correct! RT=%.3f" %(resp.rt)
else:
    msg="Oops! That was wrong"

When I tested it out, I got the following error message:
if not key_resp.keys :
NameError: name ‘key_resp’ is not defined

Where can I define key_resp?

Thanks!!

You need to use the actual name of your particular relevant keyboard component, rather than key_resp.