OS (e.g. Win11):
PsychoPy version: 2023.2.3
What are you trying to achieve?:
I’m trying to run a loop to live update what it is shown on the screen.
I have a series of Slider components in the Builder (named slider1 to slider 21).
In the “Each Frame” I have the following:
for y in range(1,22):
if globals()[“slider” + str(y)].getMouseResponses():
for x in range(1,y):
globals()[“slider” + str(x)].markerPos= 2
for x in range(y+1,22):
globals()[“slider” + str(x)].markerPos= 1
conditionslider=1
This should update the values displayed in the slider all at once, after a participant replied to only one slider (so that participants do not need to fill up all 22 sliders).
It gives the following error message:
if globals()[“slider” + str(y)].getMouseResponses():
KeyError: slider1
when the program arrives at the specific Routine.
The funny part is that a very similar piece of code used to work in previous versions of Psychopy, which is odd.
What did you try to make it work?:
Tried to change names, parameters, reduce the length of the loop.
Thanks!