Changing the position of the slider during a loop

Hi I’m trying to do a simple thing but without success.
Stimuli are displayed in a loop and after each stimulus a slider appears. I want its position to change randomly (3 states): (0, -350), (120, -350), (-120, -350) (in pixels).
At first I added an excel file with the ‘location’ variable but it didn’t pick up the variable.
After reading other people’s questions I wrote in the code (in begin routine):
posM = (0, -350)
posR = (120, -350)
posL = (-120, -350)

locs = (posM, posR, posL)
shuffle(locs)

thisExp.addData(‘locs’, locs)

Is the code correct? What should I write in ‘position’ in the slider?
Thanks!

Hello,

It seems that the Slider is still bugged when it comes to setting the Position-parameter. As soon as you set the Position-parameter to “set every repeat” from constant, the position will be set to [0,0], no matter what you want it to be. You can check this by looking at the compiled Python script.

set every repeat

slider = visual.Slider(win=win, name='slider',
    startValue=None, size=(1, .1), pos=[0,0], units=None,
    labels=[1,2,3,4,5], ticks=(1, 2, 3, 4, 5), 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=-1, readOnly=False)

should be

slider = visual.Slider(win=win, name='slider',
    startValue=None, size=(1, .1), pos=(0, -.2), units=None,
    labels=[1,2,3,4,5], ticks=(1, 2, 3, 4, 5), 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=-1, readOnly=False)

see here for an earlier mentioning of the problem

or see here

but according to this is issue is closed. So, it should work.

I’ve been using 2022.2.5, perhaps 2023.1.2 does a better job.

Best wishes Jens

Thanks for the response!
We have not reached a solution yet.
We tried to think of another way - we added 3 sliders with different positions, and in the code we wrote that only one would appear in each routine.
However, the three sliders appear together.
We would appreciate it if you have an idea what is wrong in the code,
Thanks!

Begin Experimant:
sliders = (‘sliderCenter’, ‘sliderLeft’, ‘sliderRight’)
slidersList = (‘sliderCenter’, ‘sliderLeft’, ‘sliderRight’)
slidersList = ()

Begin Routine:
if Routine.thisN == 0:
sliderCenter.started = 1
sliderLeft.started = 0
sliderRight.started = 0

elif Routine.thisN == 1:
sliderCenter.started = 0
sliderLeft.started = 1
sliderRight.started = 0

elif Routine.thisN == 2:
sliderCenter.started = 0
sliderLeft.started = 0
sliderRight.started = 1