I’m trying to create tabs that works independently on Streamlit.
The official documentation explains here how to create three tabs for eg. and it works fine. But when I change the code of (let’s say the Cat’s tab) so can an error be raised, I can’t anymore switch to Dog’s tab or Owl’s tab.
CODE :
import streamlit as st
tab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])
with tab1:
st.header("A cat")
st.image("_", width=200) # I changed here on purpose to raise an error
with tab2:
st.header("A dog")
st.image("https://static.streamlit.io/examples/dog.jpg", width=200)
with tab3:
st.header("An owl")
st.image("https://static.streamlit.io/examples/owl.jpg", width=200)
Hi @Shawn_Pereira, thank you so much for the support.
Is there by any change a way we can streamlit to not run the code inside a specific tab ?
Actually I have three tabs, the first one takes about 1 minute to display the result (because it proccess some big dataframes with pandas), so it means that I can’t switch to tab2 unless the tab1’s instructions are fully executed. It means I have to wait one minute before switching to tab2 or tab3.
@Shawn_Pereira, I used st.radio and the conditionnal works fine.
Only one problem, I tried to style the buttons but the code below does not work unfortunately :
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
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.
Performance cookies
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.
Functional cookies
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.
Targeting cookies
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.