I want to pack an image for a button press(command). But, when I press the button the label shows up but it's empty
from tkinter import *
def y():
x = PhotoImage(file= "M7.png")
image = Label(root, image=x).pack()
root=Tk()
Button(root,text="IDK" ,command=y).pack()
root.mainloop()
I want to use as a card viewer in a card game. It's a school project, that's why I use tkinter and python. The previous queastions I not understood, that's why I asked again.