Fix certain images' order, but randomly assign others

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): PsychoPy 2021
**Standard Standalone? : yes
What are you trying to achieve?:

Hi everyone,

Of the routine inside of the loop, I would like to randomize the order of images, except for the two order-fixed images.

More specifically, I have 10 images.
In the loop, I want to show 10 images one by one randomly, but only the ‘image 2’ and ‘image 5’ to be fixed at 2nd and 5th in order.
Other 8 images are to be shown randomly, like this.

< The order of image displayed >
[ any ] → [ image 2 ] → [ any ] → [ any ] → [ image 5 ] → [ any ] → [ any ] → [ any ] → [ any ] → [ any ]

Is there anyone who knows how to do this?
I would appreciate your thoughts and sharing…!

Thank you


I’ve just written up my method for Interleaved Lists onto the new Google doc I’m working on

Please let me know if you feel it needs further explanation, The use case I describe is more complicated than the one you want so my code could be simplified.

1 Like

Thank you for the reference, but since I’m very new to python code, it is so difficult for me to understand it.

May I ask you to explain your recommendation further?


Please can you be more specific about the first stumbling block you are having with understanding my solution? Have you ever used code components in PsychoPy? If you are only trying to run the experiment locally, you can ignore my PsychoJS column.

You might find my Brookes template experiment useful, since it also contains some elements of this method.

I’ve been using Builder view and haven’t used the code components properly, except for only one occasion that I have to assign participants randomly into one of several groups, after following some advices from forum.

I’m so sorry to bother you, but it would be so grateful if you explain or mention which codes should be applied in my case.