Presenting specific image component and then specific movie component in a loop


What are you trying to achieve?:
I want to present six movies in random order. In addition, before each movie, I want to present one of two images (randomly selected). Importantly, each movie has two different images that are specific to that movie.

What did you try to make it work?:
I tried to create a routine with three components- image, response button (to make the image disappear before the movie starts), and a movie. I didn’t create the loop yet.

What specifically went wrong when you tried that?:
Two things stand in my way:

  1. I am not sure how to attach each image to the movie. Is it something I can do with the builder functions or do I need a code for it? and if I need a code for it, do you have recommendations for writing this code?

  2. Assuming that I should do the routine as I did, I don’t understand how to write the condition that will make the movie start after the participant presses the response button

Thank you very much,

You can do this using loops, essentially you need to create columns in an excel table for “movie” and “image”, then have the movie file names line up with the corresponding image file names. By setting this file as a conditions file for a loop, Psychopy will randomise the order of the rows but keep each row intact. Check out the documentation for loops for more info:

Thank you! it was really helpful