PsychoPy version: 2021.1.4
I have 4 polygons and I want their border to change with a mouse click.
This works fine so far. Now I want them to change back on a second click.
What did you try to make it work?:
based on a discussion in this forum I tried the following:
(I also defined the necessary variables in the code component)
for stim in [Prac_Resp_1, Prac_Resp_2, Prac_Resp_3, Prac_Resp_4 ]:
if mouse.isPressedIn(stim):
thisClickTime = clickClock.getTime()
if (thisClickTime - lastClickTime) > bufferTime:
if stim.lineColor =='grey':
stim.lineColor = 'black'
else:
stim.lineColor = 'grey'
lastClickTime = thisClickTime
However, the color does not change back.
In a next step I tried the following:
for stim in [Prac_Resp_1, Prac_Resp_2, Prac_Resp_3, Prac_Resp_4 ]:
if mouse.isPressedIn(stim):
if stim.lineColor == 'back': (a condition that is true)
stim.lineColor = 'grey';
This did not work either. So my guess is, that there must be a problem with the evaluation of the condition, as it is not evaluated correctly.
Does anyone have an idea how to get this to work?
Thanks in advance!
Best,
Kathrin