My code:
from tkinter import *
mah_root = Tk()
mah_root.geometry("900x900")
photo = PhotoImage(file="2.jpeg")
varun_label = Label(image=photo)
varun_label.pack()
mah_root.mainloop()
Error:
Traceback (most recent call last):
File "/Users/dm19/Desktop/GUI/tut5.py", line 7, in <module>
photo = PhotoImage(file="2.jpeg")
File "/Users/dm19/opt/anaconda3/lib/python3.9/tkinter/__init__.py", line 4064, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "/Users/dm19/opt/anaconda3/lib/python3.9/tkinter/__init__.py", line 4009, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "2.jpeg"