I am trying a simple app of two widgets, where one is dependent on the other I want to user to click a button, that opens up a number slider. The user then has the option to select the number through number slider. ``` import streamlit as st press_button = st.button("Press it Now!") if press_button : th = st.number_input("Please enter the values from 0 - 10",) ``` The issue I face is the moment I change the number slider's value, streamlit reruns the entire thing, and one has to push the "button" again to get back to the number slider. Ultimately, the number slider never changes
Drop files here
or click to upload
import streamlit as st
# Create a button that shows a number slider when pressed
if 'show_slider' not in st.session_state:
st.session_state.show_slider = False
if st.button('Press it Now!'):
st.session_state.show_slider = True
if st.session_state.show_slider:
# Display a number slider when the button is pressed
th = st.slider('Please enter the values from 0 - 10', 0, 10, 0)
st.write('Slider value:', th)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?