79217866

Date: 2024-11-23 12:52:48
Score: 1.5
Natty:
Report link

To set both the window and the taskbar icon, you need to first use the ctypes commands and Afterwards the root.iconbitmap command. The skript should look something like this:

import tkinter as tk
import ctypes

# sets a basic window
root = tk.Tk()
root.title("Window")
root.geometry("800x600")

# this is the part that sets the icon
myappid = 'tkinter.python.test'
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
root.iconbitmap(r"icon_path") # used raw string to avoid backslash issues

root.mainloop()

Reference: https://www.youtube.com/watch?v=pHpI8g0COZw

Reasons:
  • Blacklisted phrase (1): youtube.com
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: RandomGuest