In the code below I am trying to set the logo for root window. I tried .ico, .gif and .png file formats. In case of .gif and .png images, logo appears only in taskbar but not on the root window. And when I try .ico image, there is an error: tkinter.TclError: couldn't recognize data in image file "icon.ico". I tried several methods but not a single one of them worked for me, out of which two methods are shown in code below. Are there any specification for the logo images like image size, resolution, dimensions etc.. In case if it matters I am using linux machine. CODE:
from tkinter import *
root = Tk()
root.geometry('400x400')
# First method
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file="icon.ico"))
# Second method
root.iconbitmap(r'icon.png')
root.mainloop()
3rd method:
root.iconbitmap(r'icon.ico')