Feedback in different images

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

OS (e.g. Win10): win11
PsychoPy version (e.g. 1.84.x): v2023.2.2
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
I want to design an experiment where there are four questions in a routin. If the answer to the question is correct, picture 1 will be displayed; if the answer is wrong, different pictures will be used to give feedback according to the type of question. I know how to use text to give feedback, but I don’t know how to use pictures to give feedback according to the type of problem.
thanks!

Hi There,

I imagine you have 2 routines, one where the response is made and a second to give feedback.

In your feedback routine add a code component. In that code component add something like the below to the Begin Routine tab:

if key_resp.corr == 1:# where key_resp is the name of your keyboard component used to make the response
    fbim = 'image1.png'
else:
    if questiontype == 1:#imagining you have a spreadsheet with the column header questiontype and the values 1 or 2
        fbim = 'image2.png'
    elif questiontype == 2:
        fbim == 'image3.png'

Then in the image in your feedback routine use $fbim in the Image field and set every repeat in the drop down.

Hope this helps,
Becca

Hi,Becca.
I have tried , but I still have no idea. I am appreciated if you help me check my experiment about comprehension_test .
Thank you for your help.
experiment.zip (1.2 MB)

Hi There,

This looks good! the code in comprehension_test1_setMsg is correct and I think it works my end.

Becca