In st.progress’s text, the documentation states “The text can optionally contain Markdown and supports the following elements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links”. But if I use st.markdown to structure the text, it will fail as the text area only accepts str or none. So how can I change the below progress_text to have bigger fonts, and orange color for example?
import streamlit as st
import time
progress_text = "Operation in progress. Please wait."
my_bar = st.progress(0, text=progress_text)
for percent_complete in range(100):
time.sleep(0.1)
my_bar.progress(percent_complete + 1, text=progress_text)
The st.progress function does indeed support markdown but is limited to the ones you highlighted above; Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links
You can however use HTML tags within st.markdown to be hacky and achieve the font size you need. Here’s an example using your code above:
import streamlit as st
import time
progress_text = '<span style="font-size: 24px;">:orange[Operation in progress. Please wait.]</span>'
my_bar = st.progress(0)
st.markdown(progress_text, unsafe_allow_html=True)
for percent_complete in range(100):
time.sleep(0.1)
my_bar.progress(percent_complete + 1)
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.