psychopy.org | Reference | Downloads | Github

Need some help coding

Hi,

I want to make an experiment that shows an image with a word that the participants have to classify into categories using 2 computer keys, when they press the wrong key they see a X.

I didn´t have any problem with all the experiment until now, but to finish I need that after the feedback that shows the X (when the wrong key was pressed) the last image with the word appears again until the participants press the right key.

I don´t know anything about coding, everything I have done until now has been through research, following tutorials and similar experiments that people posted online.

I tried this code in begin routine and also in each frame but the problem remains:

If (key_resp_5.keys == str(RespCorr)) or (key_resp_5.keys == RespCorr):
key_resp_5.corr = 1
continueRoutine = True
else:
key_resp_5.corr = 0
continueRoutine = False

Anyone can help me?

Attached file with print screen of how the experiment is built:

Exp…xlsx (1.2 MB)

(1) Please describe the actual problem.

(2) Note that .keys returns a list object, as it might contain several keys (thus why it is called keys rather than key). So your comparisons need to take that into account. e.g.

if key_resp_5.keys[0] == str(RespCorr): # compare two individual strings

or

if key_resp_5.keys == [str(RespCorr)]: # compare two lists containing a string

(3)