Hi
I want to add the logo of my organization which is stored in a variable. I want to place it at the top of the sidebar and the multi page menu at the bottom. Please can someone help.
Thank You
Hi
I want to add the logo of my organization which is stored in a variable. I want to place it at the top of the sidebar and the multi page menu at the bottom. Please can someone help.
Thank You
Hi @akshat , perhaps this might help - Streamlit (extras.streamlit.app)
pip install streamlit-extras
from streamlit_extras.app_logo import add_logo
Hi @AvratanuBiswas
I have the logo I can display that. But I want the order to be as :
If you could tell any method which would help me to achieve this, would be helpful
Thank You
Try this code, this will slove your problem!
import streamlit as st
logo_url = â./image_urlâ
st.sidebar.image(logo_url)
user_menu = st.sidebar.radio(
âSelect an Optionâ,
(âPage 1â,âPage 2â,âPage 3â,âPage 4â)
)
if user_menu == âPage 1â:
pass
#your page content, filters etc
âââBut if you want to show filters on sidebar for particular page use st.sidebar and then your filterâââ
selected_year = st.sidebar.selectbox(âSelect Yearâ,years) #years is list of years
if user_menu == âPage 2â:
pass
#your page content, filters etc
You can just add more items in the sidebar like this
import streamlit as st
from streamlit_extras.app_logo import add_logo
# add kitten logo
add_logo("https://placekitten.com/100/100")
# add sidebar buttons
st.sidebar.button("Button")
st.sidebar.button("Button 2")
# add sidebar filters
st.sidebar.slider("Slider", 0, 100, 50)
st.sidebar.date_input("Date Input")
is there a way i can manage the size of this ?
@akshat Inject custom CSS with st.markdown():
st.markdown("""<style> your css </style>""" , unsafe_allow_html=True)
Use your browserâs inspect element console for Streamlit classes names (right click > inspect element), you can try and fiddle with it on the browser first then once satisfied write the new css in your code and run it.
I canât find the appropriate class for it. It just messes up the dimensions for some logos. Can you please help?
You can simply use st.image():
with st.sidebar:
st.image("https://www.pixenli.com/image/fm0aEpMI", width=150)
If you want to use the st.markdown() instead:
with st.sidebar:
st.markdown("", unsafe_allow_html=True)
img tag, take the class name of the div that nests the img tag..divclassname img)st.markdown("""
<style>
.divclassname img {
width: 150px;
height: auto;
}
</style>
""", unsafe_allow_html=True)
NOTE:
st.image("", width=) and st.markdown("![]()", unsafe_allow_html=True) are different, Streamlit will autogenerate the class names and structure when deploying.