'How to display the window icon of a Tkinter window in the Taskbar?
When I run my Tkinter application; then it works fine. But the icon of the Tkinter window is not appearing on the taskbar. Is there any way to do it in Tkinter? Also, I've attached a screenshot below.
Solution 1:[1]
First you need to make sure you have an .ico file. Then you can do this. If you mean at the bottom as well as top you can place an image but in a different way. I added example for both.
import tkinter as tk
root = tk.Tk()
root.geometry("800x800")
root.title("My title")
tk.Tk.iconbitmap(root, default="your_icon.ico")# configure icon in normal spot
icon_file = tk.PhotoImage(file="your_file.png")#use same image but change to png file
def task_icon(): #create function to show image on a canvas
task_icon = icon_file
task.config(image=icon_file)
status_canvas = tk.Canvas(root)
status_canvas.pack(side=tk.BOTTOM, fill=tk.X)
task = tk.Label(status_canvas)
task.pack(anchor=tk.E, side=tk.BOTTOM)
task_icon()
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
