I have created a stimuli which we have named “elements”. It is a basic polygon.
I have two lists, one for positions and a second for colours. Below is the working code for creating the element and for setting the position
for Idx in range(maxElements):
elements.append(visual.ShapeStim(
win=win, name='elements'+str(Idx),
size=(0.08, 0.08), vertices=100,
ori=0.0, pos=(0, 0), anchor='center',
lineWidth=1.0,colorSpace='rgb', lineColor='black', fillColor='black',
opacity=None, depth=-1.0, interpolate=True))
if nDistractors > 1:
for Idx in range(1,nDistractors):
elements[Idx].setPos([positions[Idx][0], positions[Idx][1]])
elements[Idx].setAutoDraw(True)
This works as intended. This issue comes when we try to change the colour. We have a list called colourChoice, with a list of colours as strings. I have tried setting colour using:
elements[0].fillColor([colourChoice[0]])
And have done the same for [Idx] where it’s needed instead, but I get the error that numpy is not callable.
If I set the fill Colour in the element directly, then it doesn’t change with each repeat. It also sets all the circles to one colour, where I would like each circle to be a different colour from the list.
Any help would be great.