Show multiple images at the same time at random positions
Hello everyone,
in my experiment I'd like to show 10 small images at the same time for about 3 minutes. So I created a sketchpad with 10 images on different positions. This works fine, but of course the images always appear at the same positions. But I want the images to appear at a different position every time I restart the experiment.
I created a sketchpad with 10 predefined positions for the images, but I can't find a solution how to show the images randomly at these 10 positions.
I thought about creating an inline script, in which I create a list with the pictures and shuffle the list. Like this (a shorter verison with only three images and three positions):
import random cv=Canvas () #image positions pos1=(-416,224) pos2=(-256,-128) pos3=(-96,0) # Load images from the file pool a = pool['Def1.png'] b = pool['Def2.png'] c = pool['Def3.png'] # create list df = [a,b,c] random.shuffle(df)
Is this correct so far and how do I go from there?
How can I let the images appear at the same time randomly at the three positions?
Greetings
Christian
Comments
Hi Christian,
If I understand correctly, there are three fixed positions, and you want to vary which picture is presented where. Is that right?
In that case, the easiest approach is probably to first draw three static images at these three locations, using a
sketchpad, and then change the script so that the file keyword is variably defined, like so:And then you randomize which images are assigned to the variables
image1,image2, andimage3. Theshuffle_horizloop operation might come in useful, but you can also do it in a script.Hope this helps!
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
that worked great! Thanks a lot. :)
Greetings
Christian