If you’re creating a debugging post, please include the following info:
- Are you running your app locally or is it deployed? locally
- If your app is deployed:
a. Is it deployed on Community Cloud or another hosting platform? no
b. Share the link to the public deployed app. n/A - Share the link to your app’s public GitHub repository (including a requirements file).
- Share the full text of the error message (not a screenshot). no error
- Share the Streamlit and Python versions. current
The following code runs the “on-click” on screen load. Unless I’m missing something the on-click should only run when I click the button.
import streamlit as st
def test():
st.write(“test”)
st.button(‘Press me!’, key=“s-but1”, on_click=test())