1

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') 
1

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

0

To change the default Python icon in the taskbar for your Tkinter application, you can use the ctypes module on Windows:

import tkinter as tk import ctypes # Create your Tkinter window root = tk.Tk() root.title("My Application") # ... (rest of your application code) # Change the taskbar icon myappid = 'your_company_name.your_product_name.subproduct.version' # Choose a unique ID ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) # Load and set the icon root.iconbitmap('path/to/your/icon.ico') # Replace with the path to your .ico file root.mainloop() 

1 Comment

What's up with all the text after ---?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.