psychopy.org | Reference | Downloads | Github

Provide feedback to images

Hi all,

I am trying to build a rating system through two routines. In one routine, the participant would be presented with an image, and would be asked to choose the most appropriate rating (From 1 to 5, which are my response 's Allowed Keys.
). In the second routine, I expect the builder to show the corresponding image of the emoji that was selected by the participant.


This is my choice routine


This is my feedback routine.

The code that I have implemented is:

if response.keys == '1':
    feedback = One
elif response.keys == '2':
        feedback = Two
elif response.keys == '3':
        feedback = Three
elif response.keys == '4':
        feedback = Four
else:
        feedback = Five

And this is my conditions file:

The problem now is when I am running the experiment, no error is showing, but the feedback is only running for else command, and nothing else. Meaning, whatever I may choose from 1 to 5, only 5 is getting executed, and nothing else. Can anyone help?

Thanks in advance.

@Shardul_Shankar, try printing response.keys at the end of the first routine, to see what you are getting for each response. In a code component, in the End Routine tab:

print(response.keys)

Hi @dvbridges,

It is correctly printing the choice selected. But the image is still of else statement.

Ok, in which code tab is the following code? It should be in the End Routine tab:

if response.keys == '1':
    feedback = One
elif response.keys == '2':
        feedback = Two
elif response.keys == '3':
        feedback = Three
elif response.keys == '4':
        feedback = Four
else:
        feedback = Five

You might want to try the following debugging as well:

# End Routine
print(response.keys == '1')
print(response.keys == '2')
print(response.keys == '3')
print(response.keys == '4')

Begin Routine

That was the mistake. Thanks for the help!