Hi all,
I’ve been spending some time with streamlit, and I love it! I’m building an app and hopefully v1 will be out soon so I can showcase it. However, at the moment I’m a bit stuck with a problem and would be grateful if anyone has any suggestions.
I’m not aware if there is a component that is a slider but can also accept manually inputted number, so I am trying to connect slider
with text_input
.
I’ve placed slider
with text_input
in the same row, and passing a value (val
) from text_input
to slider, and this part works:
manual_inp_val, slider_value = st.sidebar.beta_columns([0.25,0.75])
with manual_inp_val:
val = float(st.text_input('Input:', '0.05'))
with slider_value:
st.slider('slider',
min_value = -1.00,
value = val,
max_value = 5.10,
step = 0.10)
How it works:
A value is places, slider updates, and items on dashboard update. Now, lets say I move the slider
to a new value – however the text_input
written value stays the same as previously input, doesn’t update, and I am aiming for them both to update themselves is one is changed. Otherwise it’s just confusing having these two features with different numbers… Does anyone know if such a thing is possible? Or any other suggestion that will have this functionality.
Additional note:
Why this widget? As user can update values with a slider and seeing an update on the dashboard, I do that in increments of lets say 0.5
, however, maybe user will want to have a value which is 0.52
and in that case, user can enter wanted value.