I'm using tkinter in Ubuntu (inside Windows Subsystem for Linux (WSL)). I'm trying to set the icon (.icon or .png) to my tkinter app, but all the methods I tried fail. My solutions are based on Set Window Icon in Tkinter.
Here I put my code and the results in comments:
import tkinter as tk
root = tk.Tk()
#root.iconbitmap('./icon.ico')
#error
#return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
#_tkinter.TclError: bitmap "./icon.ico" not defined
#root.tk.call('wm', 'iconphoto', root._w, tk.PhotoImage(file='./logo.png'))
#works, but empty icon
#root.iconphoto(False, tk.PhotoImage(file=r"./logo.png"))
#works, but empty icon
root.mainloop()
This is the empty icon:
All solutions work in Windows.
