# slider.setLabels() deprecated so how update labels (and ticks) each trial?

**URL:** <https://discourse.psychopy.org/t/slider-setlabels-deprecated-so-how-update-labels-and-ticks-each-trial/31351>\
**Category:** Builder\
**Created:** [October 13, 2022, 4:09pm UTC](https://discourse.psychopy.org/t/slider-setlabels-deprecated-so-how-update-labels-and-ticks-each-trial/31351 "2022-10-13T16:09:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacanterbury](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jacanterbury/32/853_2.png) [@jacanterbury](https://discourse.psychopy.org/u/jacanterbury)\
**Post date:** [October 13, 2022, 4:09pm UTC](https://discourse.psychopy.org/t/slider-setlabels-deprecated-so-how-update-labels-and-ticks-each-trial/31351/1 "2022-10-13T16:09:16Z")

</div>

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

**OS** (e.g. Win10): 10  
**PsychoPy version** (e.g. 1.84.x): 2022.1.3  
**Standard Standalone? (y/n)** If not then what?: y  
I want to change the number of options/ticks and also the associated labels on each trial in a trial loop. This used to work last year using .setLabels() but this appears to have been deprecated and I haven’t been able to get it working locally.  
Any one got any suggestions?  
Thanks

---

<div class="post-metadata">

**Author:** ![jacanterbury](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jacanterbury/32/853_2.png) [@jacanterbury](https://discourse.psychopy.org/u/jacanterbury)\
**Post date:** [October 14, 2022, 8:38am UTC](https://discourse.psychopy.org/t/slider-setlabels-deprecated-so-how-update-labels-and-ticks-each-trial/31351/2 "2022-10-14T08:38:30Z")

</div>

update:  
ticks can be updated in a code block in the routine above the slider component however updating the labels in code in the same manner does not get implemented on screen  
eg  
slider\_volume.ticks = np.array((3,4,5)) # works  
slider\_volume.labels = (‘a’,‘b’,‘c’) # original labels are retained

---

<div class="post-metadata">

**Author:** ![jacanterbury](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jacanterbury/32/853_2.png) [@jacanterbury](https://discourse.psychopy.org/u/jacanterbury)\
**Post date:** [October 14, 2022, 11:15am UTC](https://discourse.psychopy.org/t/slider-setlabels-deprecated-so-how-update-labels-and-ticks-each-trial/31351/3 "2022-10-14T11:15:37Z")

</div>

Easiest work around was just to create the slider in the ‘begin routine’ section of a code block on each trial repeat having first pre-initialised the lists you use below to populate the ticks and labels parameters. now working fine  
eg  
slider\_volume = visual.Slider(win=win, name=‘slider\_volume’,  
startValue=start\_value, size=(1.0, 0.1), pos=(0, -0.1), units=None,  
labels=slider\_labels, ticks=slider\_options, granularity=1.0,  
style=‘rating’, styleTweaks=(), opacity=None,  
labelColor=‘LightGray’, markerColor=‘Red’, lineColor=‘White’, colorSpace=‘rgb’,  
font=‘Open Sans’, labelHeight=0.05,  
flip=False, ori=0.0, depth=-2, readOnly=False)
