here is my code:
global ad4
global background
global background_l
def getvals():
print(f"the value of username is {uservalue.get()}")
print(f"the value of password is {passvalue.get()}")
if (uservalue.get()).casefold()=="avvh".casefold() and passvalue.get()=="vhjbjh":
b=Tk()
b.geometry("600x400")
ad4 = Image.open("My Post.jpg")
ad4 = ad4.resize((600, 400), Image.ANTIALIAS)
background = ImageTk.PhotoImage(ad4)
background_l = Label(b,image=background).pack()
background_l.place(x=0, y=0, relwidth=1, relheight=1)
b.mainloop()
try:
label(a).destroy()
except:
pass
else:
c=Label(a,text="incorrect pass or user name",fg="red").grid()
Error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\python 3.8.1\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "C:/Users/pc/PycharmProjects/firstfrog/PyGame/new.py", line 274, in getvals
background_l = Label(b,image=background).pack()
File "C:\python 3.8.1\lib\tkinter\__init__.py", line 3143, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "C:\python 3.8.1\lib\tkinter\__init__.py", line 2567, in __init__
self.tk.call(
_tkinter.TclError: image "pyimage4" doesn't exist