Show images that have been previously selected

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

OS (e.g. Win10): macOS Catalina 10.15.3
PsychoPy version (e.g. 1.84.x): v2020.1.1
Standard Standalone? (y/n) y
What are you trying to achieve?:

Hello

In my experiment the participants have to select snacks they would like to eat. They have a selection of 6 images (6 different snacks) on which they can click to select the ones they would like to eat and then they can continue to next routine. I have already done this routine and I am able to save the stimuli (images) on which the clicked with the code thisExp.addData(‘snacks’, mouse.clicked_name).

But in the next routine I would like to show them only the images on which they have clicked previously, to ask them which one they prefer the least. And here I’m struggling. How can I do this? I think I need to add a code component or maybe a specific excel file for the loop but I don’t know what… Could someone help?

Hi @aelreym,

You can use a code like this in the first routine:

# in the end routine tab
if my_mouse.isPressedIn(image1):
    selected_image = "imageFolder/image1.png"
elif my_mouse.isPressedIn(image2):
    selected_image = "imageFolder/image2.png"
#etc.

And then, in the second routine, use $selected_image as the path to the image component.