Search code examples
pythonfaviconflet

How to make a custom favicon in Flet


I've been trying to get a favicon working in flet, but I just can't figure out how to do it. The documentation doesn't say anything about making custom favicons, so I just wanted to know if it was possible or not.

I tried using the assets_dir parameter in flet.app but I didn't know what to do next.


Solution

  • A recent post on the official Flet Development blog answers this questions I think. Essentially an updated Flet repo adds PyInstaller functionality into a flet pack command. See the post below.

    https://flet.dev/blog/packaging-desktop-apps-with-custom-icon/

    Or if you are not packaging it, the method you used works i.e.,

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

    You just need to ensure you have created the assets folder and a file called favicon.png inside the folder.