Randomising colour of two polygons separately

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (v.2002.2.5):
Standard Standalone? (y) If not then what?:
What are you trying to achieve?:
I have two different polygon stimuli. One remains in the same position and one changes position each trial. I want each of these to change to a different random colour on each trial (so polygon 1 should be a different colour than polygon 2).

What did you try to make it work?:
I have an excel sheet set up to randomise colours and I am using a different column for each polygon

What specifically went wrong when you tried that?:
At the moment the colour is changing on each trial but they are both coming up as the same colour as each other.

I’m guessing there is some code I need to add but I’m not super great with it and kind find any examples on a search so would really appreciate some advice!

Thanks in advance.

Hello KristyB

do you mind showing us how you tried to achieve to randomize each polygons’ color? It should work without code.

Best wishes Jens

Dual_task.psyexp (20.4 KB)

I’ve uploaded the experiment here and the conditions file looks like this:

Hello KirstyB

did try to specify the colours in the Excel-file wih “[” and “]” instead of “(” and “)”?

Best wishes Jens

Hi Jens,

I’ve just tried that but no luck :frowning:


try this
randColor.psyexp (7.6 KB)
randColor.xlsx (8.4 KB)

Best wishes Jens

Hi Jens,

Thank you for this unfortunately it doesn’t resolve the issue. I am able to randomise the colour of one polygon, the problem I am having is that I cannot randomise the colour of two polygons (they both take the same colour despite drawing from two different columns).


Have a look at my independent randomisation demo.

Thank you. I have actually just this second got it working with the excel file. For anyone else looking for a solution I ended up creating a new excel file (with all of the same information) and it worked so there must have been some error in the original excel file.