from tkinter import *
windows = Tk()
windows.title("My Project")
windows.geometry('600x400')
icon = PhotoImage(file='logo.png')
windows.iconphoto(True,icon)
# windows.iconbitmap('mylogo.ico')
windows.mainloop()
Error :
Traceback (most recent call last):
File "e:\PROGRAMMING\Code in VS code\CODES\PROJECT GUI\gui_project.py", line 6, in <module>
icon = PhotoImage(file='logo.png')
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 4093, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "C:\Users\Hp\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 4038, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't open "logo.png": no such file or directory
Here image also added in gui 's folder . I tried direct path also and ico logo too. But failed.