I am trying to create simple streamlit app which capture the user input using two buttons one is to open a text input and another one to display the text
After clicking the second button instead of displaying text its closing automatically
Any idea would be appreciated
import streamlit as st
st.title("Main Page")
if st.button("My Button"):
my_input = st.text_input("Input a text here")
submit = st.button("Submit")
if submit:
st.text("You have entered: ", my_input)
One option for center aligning is to use columns. This adds 3 columns, and puts the button in the center column.
import streamlit as st
st.title("Main Page")
if st.button("My Button"):
my_input = st.text_input("Input a text here")
_, center, _ = st.columns([3, 1, 3])
submit = center.button("Submit")
if submit:
st.write("You have entered: ", my_input)