Draw visual.ImageStim on top of visual.MovieStim - is that possible?

Hi community!

I am currently planning a new experiment and therefore we aim to create videos that I want to display in Psychopy later. My question is, if it is possible to display a visual.ImageStim on top of a currently running video? So is it possible to create a second visual layer on top of a visual.MovieStim?

Maybe someone has experiences to share :slight_smile:

Thanks so much!

Best,
Carola

Hi Carola,

It should be possible to have a movie running and to present stimuli in front of the movie, you would just need to call for the stimuli to be drawn after the movie.

For example:

while frame < 10:
    movie.draw()
    image_stim.draw()
    win.flip()

Best Regards
Aimee

Thanks so much! That will do it :slight_smile:

Hi Aimee,

Do you know how to do it in the Builder? Is it possible to add a text component on top of a currently running video?

Best regards,
Lucia

Hi Lucia,

Yes, it is possible to add text over a running video.

In builder, you can display text over the movie by setting them to appear on screen in the same time frame and having the movie component at the top of the routine (you can either set up the movie first then text, or right click on movie and select move to top, that way the text appears on top of the movie).

Best Regards
Aimee

Hi Aimee,

Perfect, thank you very much for your explanation! I want the text to appear when participants press “space”, so I have to add it using a code component, right?

Best regards,
Lucia Hernandez

Hi Lucia,

No problem :slight_smile:

Instead of adding a code component, in the text properties you can set the start of the text to ‘condition’ (instead of time or frame N) and write the following (assuming the keyboard component is labelled as ‘key_resp’ and the keyboard should be above the text):

$key_resp.keys == 'space'

This way the text won’t appear until the space bar has been pressed.

Best Regards
Aimee

1 Like