# Error with slider during loop -- Trying to use variable slider labels

**URL:** <https://discourse.psychopy.org/t/error-with-slider-during-loop-trying-to-use-variable-slider-labels/19491>\
**Category:** Builder\
**Created:** [January 8, 2021, 3:44pm UTC](https://discourse.psychopy.org/t/error-with-slider-during-loop-trying-to-use-variable-slider-labels/19491 "2021-01-08T15:44:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zshawver](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/zshawver/32/13887_2.png) [@zshawver](https://discourse.psychopy.org/u/zshawver)\
**Post date:** [January 8, 2021, 3:44pm UTC](https://discourse.psychopy.org/t/error-with-slider-during-loop-trying-to-use-variable-slider-labels/19491/1 "2021-01-08T15:44:36Z")

</div>

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

**OS:** Win10  
**PsychoPy version** (e.g. 1.84.x):  
**Standard Standalone?** yes  
**What are you trying to achieve?:**  
I want people to make five different ratings (e.g., curiosity, degree of mystery) for a sentence on-screen.  
I am using the slider component to collect the ratings.  
The sentence will remain static at the top of the screen.  
I want to show one rating question at a time (e.g., How curious are you to learn what happens next, How a great a mystery does this sentence present?).  
The question and the anchor will change after each rating.

In summary: People will read a sentence and a press a spacebar when they have understood it. Then they will make five ratings, one-at-a-time, that measure different dimensions about that sentence.

**What did you try to make it work?:**

I created two routines, one for which people read the sentence and one for which they make their ratings. The sentence reading routine is a straightforward text + keyboard response. The sentence ratings routine has the same sentence in the same location, but adds an additional text component for the rating question and the slider component.

I created a loop around the ratings routine.

I first created a conditions file with two variables, one for the rating question and one for the anchors that will appear. In Labels for the slider component I entered `$anchors` and received a syntax error (EDIT: I did switch to setEveryRepeat from constant):

```auto
I don't know the appropriate default value for a 'labels' parameter. Please email the mailing list about this error
## Running: C:\Users\Zared\Documents\PsychoPy\diss\Pilot V2 Masters\Diss_Pilot_V2Masters_NormingRatings_lastrun.py ##
3300.9054 INFO Loaded monitor calibration from ['2019_08_08 10:34']
  File "C:\Users\Zared\Documents\PsychoPy\diss\Pilot V2 Masters\Diss_Pilot_V2Masters_NormingRatings_lastrun.py", line 112
    labels=[$anchors], ticks=(0,1,2,3,4,5,6),
            ^
SyntaxError: invalid syntax

```

I then tried to separate the anchors into two variables, thus for Labels I entered `$leftAnchor, $rightAnchor` to no avail and received a similar syntax error pointing at the labels argument. The error message is exactly the same, so I did not include it for brevity.

I realize that I could create 5 different sliders with the same location and trigger them to start and stop using conditions and a code component. (I will probably move forward with this, clunkier solution for the sake of getting data). However, I would prefer the more elegant solution of being able to use variables for the slider Labels. Am I missing something about how to do that correctly?
