Problems converting manually set sliders to psychoJS

I figured it out; it turns out that I can’t create a new visual.Slider manually in JS (I can do so in PsychoPy), but I can manually set the existing slider properties depending on my conditions table:

code in PsychoPy:

    qn_slider = visual.Slider(win=win, name='qn_slider',
        size=(0.025, slider_height), pos=(0.1, 0), units='height',
        labels=demolabels, ticks=demoticks,
        granularity=1, style=(respStyle),
        color='LightGray', font='HelveticaBold',
        flip=False, labelHeight = .04)

code in JS (with a slider component also added in the builder):

    qn_slider.size = [0.025, slider_height];
    qn_slider.labels = demolabels;
    qn_slider.ticks = demoticks;
    qn_slider._needVertexUpdate = true;
    qn_slider._buildSlider();
1 Like