How to change the default loading icon in a Python flet app?
Question:
I am building a graphical user interface using flet
in python.
However, I am stuck with the default flet
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?
Answers:
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
@Panos Stavrianos
It works and without even manifest.json
file, but not with all ports.
With:
flet.app(target=main, assets_dir="assets", port=#####, view=flet.WEB_BROWSER)
on my box, my personal favicon strangely doesn’t work when port is between 41556 and 41559.
I am building a graphical user interface using flet
in python.
However, I am stuck with the default flet
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?
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
@Panos Stavrianos
It works and without even manifest.json
file, but not with all ports.
With:
flet.app(target=main, assets_dir="assets", port=#####, view=flet.WEB_BROWSER)
on my box, my personal favicon strangely doesn’t work when port is between 41556 and 41559.