pythonweb-applicationsicons

How to change the default loading icon in a Python flet app?


I am building a graphical user interface using flet in python.

However, I am stuck with the default flet logo

this logo

while loading the app in the browser viewer, and I don't see any hints about changing it in the documentation.

Is this possible?


Solution

  • Create a folder in your root directory named assets.

    Inside place your logo named favicon.png

    Finally, point flet to your assets folder

    flet.app(target=main, assets_dir="assets", view=flet.WEB_BROWSER)
    

    Additionally, check here how to add your own manifest

    UPDATE: Check this article if you want to make an executable with pyinstaller and add a custom icon. Previously, to do this, required some dirty tricks (replace the flet icon inside the .exe file).

    It seems like now it's as easy as

    flet pack your_program.py --icon <your-image.png>
    

    link to the documentation