How to randomise a picture or a Polygon

I would like to have a presented word flicker 2-4 times at random intervals within a 20-second period during an experiment. One idea is to briefly display an image with the fitting background color for 0.5 seconds, and repeat this process 2-4 times or to present a polygon to cover the words up shortly. Does anyone have any ideas on how to achieve this?

Thanks in advance

If the word is the entire contents of the text component (e.g. called text_word) then you could make it flicker three other ways without using an additional component.

  1. text_word.text = '' and then back to text_word.text = word
  2. text_word.setOpacity(0) and then back to text_word.setOpacity(1)
  3. text_word.setPos([2,2]) and then back to text_word.setPos([0,0])

It would also be possible to change the colour of the text to the background colour but that seems less logical.

You will need some Each Frame code. e.g.

if text_word.text == '' and t > timeChange:
     timeChange += 4 + random() * 4
     text_word.text = word
elif text_word.text == word and t > timeChange:
     timeChange += .5
     text_word.text = ''

You will need to set timeChange = 4 + random() * 4 in Begin Routine

Thank you for your quick reply! Would it be possible to solve this problem in the builders-mode, too? I’m very new in using Psychopy…

I only use Builder – but add code components to it.

1 Like