How to set app icon on windows with python
Hello, is there a way to set the app icon for the taskbar on Windows with Python? I was able to use some low level windows API to change the actual window icon, but I could not use them to set the actual taskbar icon. It seems that the assets folder that is used for C++ apps is not used for Python. Thank you in advance for any suggestions or help. I have a standalone Python that I use for all of my apps and I really don't want to have to use PYinstaller. If it comes down to it, I will RC edit the python.
Thanks Joe
Hi,
I'm sorry the tools to change the icon are specific to C++ apps, and will not work with Python. Setting an app icon is very dependent on the OS.
Under windows, glfw (which is used by hello imgui in python) is able to set the window icon
See for example:
"""Demonstrates how to manipulate the glfw window created by HelloImGui.
glfw_utils.glfw_window_hello_imgui is a function that returns the main glfw window used by HelloImGui
"""
from imgui_bundle import hello_imgui, imgui, glfw_utils
import glfw
from PIL import Image
def gui():
imgui.text("Hello")
if imgui.button("set icon"):
win = glfw_utils.glfw_window_hello_imgui() # get the main glfw window used by HelloImGui
path = "F:/dvp/_Bundle/imgui_bundle/bindings/imgui_bundle/assets/images/world.png"
img = Image.open(path)
imgs = [img]
glfw.set_window_icon(win, 1, imgs)
glfw.init() # needed by glfw_utils.glfw_window_hello_imgui
hello_imgui.run(gui)
Thanks! I will try today!