Multiple images with different locations in a single screen

OS (e.g. Win10): win10

PsychoPy version (e.g. 1.84.x): v2021.1.0

Standard Standalone? (y/n) : yes

Hi, I am new to Psychopy and of little experience with coding. I want to make a single screen contain total 12 images with different, pre-determined locations. However, I do not know how to do it.

First, I made lists, for example,

img_list = [‘pwd/file_1.png’, …, ‘pwd/file_12.png’] for images to be shown, and;

img_loc = [(x1,y1), …,(x12,y12)] for locations of the image stimuli.

Then I have tried to use multiple image components in builder, let us call image_1 to image_12. But it failed. Only the first image component, image_1, was on the screen. Trials ended with no error message.

Also, I tried to define ‘image’ in image component as $stim_list[0:12] or $stim_list and location as $stim_loc[0:12] or $stim_loc, respectively, but then Psychopy failed to understand it and gave the following error message:

AttributeError: Couldn’t make sense of requested image.

How can I do it?

Hi There,

It looks like you are trying to specify a range of images within a single image field inside your image component. The image component can only read one image file. To guide you on your way here is a demo where we do something similar. Present 6 images (randomly selected from a list) in 6 different locations.

You can download the experiment demo here:

Hope this helps,
Becca

Oh! Thank you. It works.

I think there might have been a problem in my location code, not my img_list.

Thanks Becca!

1 Like