Problems with changeing slider start and end vlaues

Hello

I am trying to change slider start and end values with textInput.

div = Div(text="0", style={"font-size": "150%", "color": "white"})
slider = Slider(start=0, end=10, value=0, step=1, title="Slider")
text_input = TextInput(value="0", title="Start index")
text_input.js_on_change(
    "value",
    CustomJS(
        args=dict(text_input=text_input, div=div, slider=slider),
        code="""
        const temp = text_input.value
        div.text=temp
        slider.value=temp
""",
    ),
)

show(row(text_input, div, slider))

Given code above works as intended, it changes the value of slider when I enter new value to text_input field.
Text div is just there to let me know if entered text value went through.
When I tried to change slider.start or slider.end it doesn’t update the slider.

Thanks in advance

Three slider values need to be numbers. You will need to convert the text value from the input.

Thanks!
I thought about that changing it to number but every time I changed it to integer and it didn’t work. But now I realized that float is also a number :slight_smile: and I worked with float.

slider.value also worked with text, that confused me alot.

1 Like