psychopy.org | Reference | Downloads | Github

Colour not updating in Image component

Hi

I haven’t used psychopy for a while so I’m a bit rusty.

OS: Win10
PsychoPy version (2021.2.1)
Standard Standalone

What I’m trying to acieve is really pupilometry test. A gray central fixation cross with a background that alternates between black and white every 5secs, and repeats 5 times. So I have a Routine with 3 Components: TextStim (fixation +) from 0 - 10sec; black ImageStim from 0-5sec; white ImageStim from 5-10sec, in that order on the routine. Then a sequential loop with nReps 5.

Using image component, whichever way I specify “black” and “white” in Properties → Appearance → Foregroud colour (in text, or RGB values), the background colour just defaults to the screen colour in experiment settings (which I can change). I’ve tried implementing the same thing on two different computers now. So it is probably something simple I’m (not) doing. I can’t for the life of me think what though, I’ve done much more complicated things than this in PsychoPy before.

No error message, the screen just does not alternate between black and white. This is the info from the log file when creating the first ImageStim ‘black_image’:

Created black_image = ImageStim(__class__=<class 'psychopy.visual.image.ImageStim'>, autoLog=True, color=array([-1., -1., -1.]), colorSpace='rgb', contrast=1.0, depth=-1.0, flipHoriz=False, flipVert=False, image=None, interpolate=True, mask=None, maskParams=None, name='black_image', opacity=1, ori=0.0, pos=array([0., 0.]), size=array([0.5, 0.5]), texRes=128.0, units='height', win=Window(...))

And when running the first trail:

11.5458 EXP Created sequence: sequential, trialTypes=1, nReps=5, seed=None
11.5460 EXP New trial (rep=0, index=0): None
11.5919 EXP fixation: autoDraw = True
11.5919 EXP black_image: autoDraw = True
16.5376 EXP white_image: autoDraw = True
16.5981 EXP black_image: autoDraw = False
21.5468 EXP white_image: autoDraw = False

Apologies if I’m just being daft, but this should work, right?

Thanks for any help that comes my way.

Best,
Richard

Is there any particular reason you’re using an image component instead of a shape component?

Not really. A shape component does actually work though, thanks!

I’m curoius as to why I can’t change the colour of an image component though - this has worked fine with earlier versions. It would be surprising if no-one else has experienced this, so it is likely something I am doing wrong

1 Like