简体   繁体   中英

Is there any option in tkinter to change the taskbar Icon?

I'm new in tkinter. I am trying to change the icon of the Tkinter window but it's change only the icon of the top title bar in the window, But I'm also want to change the icon which is present in the taskbar. Is there any way to solve it?

root.wm_iconbitmap(r'C:\Users\Jawad Saqib\Desktop\Desktop\Python\jawad.ico')

No,

you can like make it to an exe and then also give it an taskbar icon but, because the python is executed in a python launcher it wil not can changed trough code.

To change the icon displayed in the actual window, (assuming root is the Tk() instance, you run root.iconbitmap(icon) .

To change the icon displayed in the taskbar, you'd need to compile to code into exe or your system executable and set an icon, because the icon in the taskbar is the exe that's running. In this case, the executable that is running is python, and it is displaying the python icon. Or the tkinter icon - it varies on platform.

Eg. pyinstaller --icon=icon.ico myscript.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM