[Python] image as part of the page_navbar in Shiny Python

Discussão em 'Python' iniciado por Stack, Julho 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have a simple Shiny Python App which I want to add an image as a logo on the menu's left hand side. I created my wwww folder and I saved the logo.png file there. I don't know why I cannot see the image when loading my Shiny App. I share the code as follow:

    from shiny import App, ui

    app_ui = ui.page_navbar(
    ui.nav_panel("Bar", ui.h2("Bar plot")),
    ui.nav_panel("Map", ui.h2("Cloropleth")),
    ui.nav_spacer(),
    ui.nav_control(ui.input_dark_mode(id="dark_mode_switch")),
    title=ui.tags.a(ui.tags.img(src="logo.png", height="30px"), "", href="#")
    )

    app = App(app_ui, server=None)
    if __name__ == '__main__':
    app.run()


    My folder structure is main_folder which contains the www folder and the app.py file. I am using Python 3.12 and shiny 1.4.0. Thanks in advance.

    Continue reading...

Compartilhe esta Página