Unfortunately, I wasn’t able to replicate the issue. What version are you on?
Also, does the whole script rerun and does the input value change in Python?
Please tell me more about the issue and I’ll be happy to help you out.
And thanks for using Streamlit!
The button and UI show-up as intended, however, the app re-runs whenever any of the input parameters are changed. The intention is to batch any changes with a click of the submit button.
I am running the latest version of streamlit (0.83.0).
Happy to help! As you are declaring widgets in the sidebar using the with syntax, you need to call them via st.widget instead of st.sidebar.widget:
import streamlit as st
with st.form(key ='Form1'):
with st.sidebar:
user_word = st.text_input("Enter a keyword", "habs")
select_language = st.radio('Tweet language', ('All', 'English', 'French'))
include_retweets = st.checkbox('Include retweets in data')
num_of_tweets = st.number_input('Maximum number of tweets', 100)
submitted1 = st.form_submit_button(label = 'Search Twitter 🔎')
Alternatively, you can use st.sidebar.form and dispense with the nested with statement altogether. This has an added benefit of making your code easier to read:
import streamlit as st
with st.sidebar.form(key ='Form1'):
user_word = st.text_input("Enter a keyword", "habs")
select_language = st.radio('Tweet language', ('All', 'English', 'French'))
include_retweets = st.checkbox('Include retweets in data')
num_of_tweets = st.number_input('Maximum number of tweets', 100)
submitted1 = st.form_submit_button(label = 'Search Twitter 🔎')