psychopy.org | Reference | Downloads | Github

Delayed feedback

OS (e.g. Win10): Windows 10 home
PsychoPy version (e.g. 1.84.x): 1.90.1

Hi, I’m having trouble with one aspect of my experiment. Participants are shown a stimulus and they give their answer, which is recorded. Then after they complete all the tests I want them to receive feedback on all their answers. I couldn’t figure out how to provide feedback if the tests were in the loop so in the end I’ve put each test and corresponding feedback as a separate routine. It all worked fine with substitute words, but once I put in actual words and stimuli it only gives incorrect feedback…
My test routine looks like this:


with the code component like this:

Begin Experiment:
import string
allLetters = list(string.ascii_lowercase)
Begin Routine:
textFill = ''
Each Frame:
keys = event.getKeys()
if 'escape' in keys:
    core.quit()
else:
    if keys:
        if keys[0] == 'space':
            textFill += ' '
        elif keys[0] == 'backspace':
            textFill = textFill[:-1]
        elif keys[0] in allLetters:
            textFill+=keys[0]
        showresponse1.setText(textFill)
End Routine:
thisExp.addData("textResponse", showresponse1.text)
if showresponse1.text.lower() == answercorrect1.text.lower():
    correctResp = 1
else:
    correctResp = 0

My feedback routine looks like this:


with the code component like this:

Begin Experiment:
msg=''
Begin Routine:
if showresponse1.text.lower() == correctanswer1.text.lower():
    msg="Correct!"
else:
    msg="Incorrect!"

Basically what I need is for my feedback routine to be able to tell whether the showresponse from the test routine is the same as the correctanswer component. Like I said it seemed to work fine with substitute words, but when I put in actual stimuli it stopped.

I’d appreciate any help!