Hello,
I see there is a possibility to use the on_change
keyword on some widgets:
Widgets which support the on_change event:
• st.checkbox
• st.color_picker
• st.date_input
• st.multiselect
• st.number_input
• st.radio
• st.select_slider
• st.selectbox
and in particular the selectbox widget. But when I try to use it, even with the default value which is None, there is an error:
TypeError: selectbox() got an unexpected keyword argument 'on_change'
Why is that ?
Thank you
Hmm I just noticed that I didn’t have the latest version of Streamlit that’s why …
1 Like
I’ve just stumbled upon this new on_change
feature for text_input
but I can’t figure out how to use it. Can you share how you managed to get it to work?
Hello,
If you install the latest version of Streamlit:
pip install --upgrade streamlit
You will be able to make the on_change event work .
I don’t remember if text_input has this behavior possible but if it has , with the latest version of Streamlit it should work I guess
Edit: yes on_change is available for text_input
Here is the full list:
https://docs.streamlit.io/en/latest/session_state_api.html