Hello All,
is there way we can create a new Page with a button click using Streamlit?
As of now I could keep on increasing my page’s length by keeping on adding widgets, but I want them to a new page.
Thanks in Advance.
Hello All,
is there way we can create a new Page with a button click using Streamlit?
As of now I could keep on increasing my page’s length by keeping on adding widgets, but I want them to a new page.
Thanks in Advance.
Hey @Harish_Kodarapu,
You can do this with the st.radio
command in streamlit. Ideally you would use this because it preserves the state of the radio button no matter what you do on each page (click buttons, display data etc…)
import streamlit as st
my_page = st.sidebar.radio('Page Navigation', ['page 1', 'page 2'])
if my_page == 'page 1':
st.title('here is a page')
button = st.button('a button')
if button:
st.write('clicked')
else:
st.title('this is a different page')
slide = st.slider('this is a slider')
slide
gives:
for the first page:
for the second page:
Happy Streamlit-ing!
Marisa
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.