Set colour parameter

OS (e.g. Win10): macOS Mojave
PsychoPy version: 3.0.7

What are you trying to achieve?:
Hi everybody, I have two conditions (red stimulus, blue stimulus), so I’d like to create a colour-parameter (Name: Stimcolour) to change the colours of my stimuli. When I try to set $Stimcolour in the textfield for the colour of the stimuli and try to run the experiment, I get an error message:

fillColor=Stimcolour, fillColorSpace=‘rgb’,
NameError: name ‘Stimcolour’ is not defined

I think the parameter gets somehow mistaken for a colour name (?).

What did you try to make it work?:
First I tried using an excel file with a column named Stimcolour, but when that didn’t work, I tried using code:
if random()>0.8:
Stimcolour=(0,0,255)
else:
Stimcolour=(255,0,0)

Instead of the rgb-colours I tried using the colour names but that doesn’t work either.

I never used Psychopy or Python before, so I don’t really know how to fix this or what exactly went wrong. It would be awesome if someone could maybe help me with this. :slight_smile:

@Merle, I think your issue is with how the variable updates. You need to set the fillColor param to update on every routine.

1 Like