79325046

Date: 2025-01-02 21:58:59
Score: 1
Natty:
Report link

For python 3.8 and cefpython3 66.1 on Windows 10 pro

I defined on win32gui_struct the following method (can also be directly defined outside it will work. Note however that you could have an import error as win32gui.py is not existing but thanks to win32gui.pyd it will work at runtime)

def set_icon(title,icon_path):
    w_hnd = win32gui.FindWindow(None, title)
    icon_flags = win32gui.LR_LOADFROMFILE | win32gui.LR_DEFAULTSIZE
    hicon = win32gui.LoadImage(None, icon_path, win32con.IMAGE_ICON, 0, 0, icon_flags)
    win32gui.SendMessage(w_hnd, win32con.WM_SETICON, win32con.ICON_SMALL, hicon)

#This method can be used with:
win32gui_struct.set_icon("title of the window","C:\\Users\\toto_is_happy\\IdeaProjects\\CefPythonTrial\\Win32GUI\\lib\\cefpython3\\examples\\resources\\chromium.ico")
Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: diblud13