Multi slider zero range

Hello all!

I’ve recently encountered the following issue: streamlit app seems to enter an infinite loop and fail if the multi slider range equals to zero. It happens either by specifying the range programmatically by default or if user selects zero range during interaction with the app.

Here is a simple code example which ends up failing:

st.slider('title', 0.0, 100.0, (25.0, 25.0), 0.5)

Is there any way to fix this?

Hey @AnglewoodJack,

Can you make a slightly larger MWE of this happening?

I would love to be able to reproduce this behaviour locally, I copy pasted your slider and i’m not entering any infinite loops here!


Hi @Marisa_Smith!

Thank you for your help. I think I have found what was the actual problem - the widget cannot render large ranges with small steps. For example, I cannot do something like this (at least on my laptop):

st.slider('title', 0.0, 5000000.0, (300000.0, 3000000.0), 0.01)

Some of the sliders in my app use varables resulted from other calculations as parameters, which are happened to be very large. Thus I just replaced those sliders with st.number_imput.

1 Like

Hey @AnglewoodJack,

So you were able to solve your issues by using st.number_input instead, thats great!

Happy Streamlit-ing!

1 Like