create an app that upon triggering a button, it disables it until it finishes processing
Drop files here
or click to upload
import streamlit as st
import time
def process():
time.sleep(5) # Simulate a long-running process
st.title('Disable Button Example')
if 'button_disabled' not in st.session_state:
st.session_state.button_disabled = False
if st.session_state.button_disabled:
st.button('Processing...', disabled=True)
else:
if st.button('Start Processing'):
st.session_state.button_disabled = True
process() # Start the processing
st.session_state.button_disabled = False # Re-enable button after processing
st.success('Processing complete!')
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?