Hello!
I was trying to add a logo (image) to the header of my Shiny (Python) app. I found a lot of similar doubts on how to implement this in R shiny but not in Python. Additionally, I'm using Shiny Express.
This is a snippet of my code so far:
ui.page_opts(title="ETABS Workbook Visualisation", fillable=True, id="page")
with ui.sidebar():
ui.input_file("file1", "Upload an ETABS workbook", multiple=False, accept=[".xlsx"])
ui.input_radio_buttons(
"section",
"Section Choices",
choices=["Beam", "Column", "Slab", "All Section"],
selected=["Beam"],
)
with ui.nav_panel("Mass Per Section"):
"some content here"
with ui.nav_panel("Something else"):
"Something else"
with ui.nav_panel("Something else 2"):
"Something else 2"
ui.nav_spacer()
with ui.nav_control():
ui.input_dark_mode()
You need to include the logo in your app files or have it hosted online somewhere. Then change the src argument in img to point to the web address where that logo can be found. See these docs for an example of how a CSS file is sourced, but the same applies for an image: Shiny for Python - Customizing UI