Skip to content

Packaging an app and its icon when using Python #427

Closed

Description

@jakerdy

Hi!

I am trying to use imgui_bundle to develop a Python-based desktop app for computer graphics. The first thing I tried was setting a custom icon for the window, but I had no luck.

I put my icon at assets/app_settings/icon.png as required in readme, but it won't show up. I tried different files that match the specs (256px), but nothing worked.

My env:

  • Windows 11
  • Python 3.13.1
  • imgui-bundle 1.92.5
  • uv 0.9.5

You can find repo here: https://github.com/jakerdy/imgui_bundle_noicon.git

There were no errors printed in the terminal; the icon simply won't show up.

Activity

  1. changed the title [-]Window icon not showing up[/-] [+]Window icon not showing up when using Python[/+] on Dec 25, 2025
  2. jakerdy commented on Dec 25, 2025

    @jakerdy
    Author

    Ok, I found a hack. You could put your custom icon into site_packages of venv. But what is an intended way of changing icon in python based apps?

  3. pthom commented on Dec 27, 2025

    @pthom
    Owner

    Hi @jakerdy,

    Thanks for reporting this!

    First, there are two things you need to know.

    C++ vs Python:
    In C++, Hello ImGui and ImGui Bundle can provide icons for applications' exe files. When using Python, the icon is linked to the Python executable itself. You need a packaging tool (such as PyInstaller, for example) to override Python's icon.

    Window icon versus App icon

    There are two different types of icons:

    1. Window icon: The icon shown in the window title bar and taskbar while the app is running (works only on Windows and Linux, not available on macOS)
    2. App icon: The icon of the executable/application file itself (shown in file explorers, app launchers, etc.). On macOS, this will also be the window icon.

    Current Support in Python

    Window Icon (Windows & Linux only):
    With Python, assets/app_settings/icon.png should define the window icon on platforms that support this (Windows and Linux, but not macOS). However, you need to:

    1. Set the assets folder correctly at the start of your application:

      from imgui_bundle import hello_imgui, immapp
      import os
      
      def main():
          # Set assets folder - adjust path to your setup
          assets_path = os. path.join(os.path. dirname(__file__), "assets")
          hello_imgui.set_assets_folder(assets_path)
          
          # Your app code... 
          immapp. run(...)
      
      if __name__ == "__main__": 
          main()
    2. Icon specifications: Make sure your icon.png is:

      • Square
      • At least 256×256 pixels (512×512 is preferred)
      • Located at <your_assets_folder>/app_settings/icon.png

    App Icon (Packaged Applications):
    The automatic icon.png conversion from assets/app_settings/icon. png is currently a C++ only feature (it requires CMake during build).

    For Python applications, you need to use packaging tools like PyInstaller to set the application icon when creating standalone executables.

    Packaging Your Python App with Custom Icon

    ImGui Bundle provides examples for packaging Python applications with PyInstaller:

    Demo & Documentation:

    For Windows with PyInstaller, you would create a spec file like this:

    # yourapp.spec
    a = Analysis(
        ['your_app.py'],
        datas=[("assets", "assets")],  # Include assets folder
        # ... other settings
    )
    
    exe = EXE(
        pyz,
        a.scripts,
        # ... other settings
        icon='path/to/your_icon.ico',  # <-- Set app icon here (Windows uses . ico)
    )

    Then build with:

    pip install pyinstaller
    pyinstaller yourapp.spec

    Summary

    • Development: The window icon from assets/app_settings/icon.png should work if you call hello_imgui.set_assets_folder() correctly
    • Distribution: For the app icon (executable icon), you need to use PyInstaller or similar packaging tools with their icon settings
    • C++ vs Python: The automatic icon conversion is a C++ build-time feature; Python apps need packaging tools for app icons

    I hope this clarifies things! Let me know if you need more help.


    Disclaimer: this answer was based on a reply by github copilot which I did proof-read and reword.

  4. added
    faqA frequent question, answered
    on Dec 27, 2025
  5. jakerdy commented on Dec 27, 2025

    @jakerdy
    Author

    Thank you very much for such a detailed answer!

    It's a great fit for the docs. Yep, I've been digging into the source code for the last couple of days and asking GPT-5.2 (it knows how your library works pretty well). So now I know now. Going to check pyinstaller...

    Also, I was struggled a bit with immapp vs hello_imgui. It would be great to write some top level overview of modules available in a lib and their primary function.

    So far, this is the best ImGui "bundle" that just works, and it comes with multiple packs of batteries included, not just one :)

  6. pthom commented on Dec 27, 2025

    @pthom
    Owner

    reopen as faq

  7. reopened this on Dec 27, 2025
  8. changed the title [-]Window icon not showing up when using Python[/-] [+]Packaging an app and its icon when using Python[/+] on Mar 24, 2026
  9. pthom commented on Oct 21, 2026

    @pthom
    Owner

    Closing this to keep the open issues for open problems.
    The answer stays here, and all the FAQ answers are listed here:
    https://github.com/pthom/imgui_bundle/issues?q=is%3Aissue+label%3AFAQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    faqA frequent question, answered

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions