How to give conditional feedback

I am looking for the way of giving conditional feedback. For example, giving a question which has three options with only one write answer. For pressing the write option subject will see “correct” feedback and wrong for other else. For 12 questions subjects will see conditional feedback. After following coding rules it s giving such errors.
Please help me.

  • The keyboard component doesn’t have an attribute called .corrAns. You need to refer to key_resp.corr instead.
  • Please also paste in your code as text into your posts: it is much easier to give a proper response if we can copy and paste from your code, which we can’t do from photos of your monitor.
  • In your list of image filenames, you aren’t providing an extension for each one (e.g. .jpg or .png). This means that your images won’t be able to be found. You should set your operating system to display the extensions for all files instead of hiding them, so you can see how to name them completely.

Thank you for the reply. am using psychoPy3. In this version it does not take image extension, jpg etc.
For writing the code I used this way:

imagefile = ['image_fold/correct_img.jpg','image_fold/incorrect_img.jpg']

if key_resp_2:
    image=imagefile[0]
else:
    image=imagefile[1]

But it gives atrribute error
AttributeError: Couldn’t make sense of requested image.
I can’t detect that where is the problem.
I made a loop uploaded excel sheet for showing image, added keyboard there, while it is time for giving response for right and wrong answer among option it creates problem. What can I do now?

Regardless of version, PsychoPy will always need to know the exact name of your files. So extensions are always required.

image=imagefile[0]

What is the image variable that you are setting here? What are you wanting to happen with this line?

I’m going to guess that you actually have an stimulus component called image (we can’t tell from the wonky photo). If so, this line would destroy that component and overwrite it with just a filename (like 'image_fold/correct_img.jpg'). This would be consistent with the error you report. What you could do is just create a variable name that you then use in your image stimulus component’s “image” field. e.g.

if key_resp_2.corr: # note that you need the .corr bit here
    feedback_image_file = imagefile[0]
else:
    feedback_image_file = imagefile[1]

and then just put $feedback_image_file in the image component image field.

There is a lot of guesswork here. Please provide the full text of any error message, and take screenshots that show everything we need to see, rather than just selections.