我正在尝试从实例类中插入PILLOW图像。但是图像不显示。谁能帮我?谢谢!
from tkinter import *
from tkinter import ttk
from PIL import Image, ImageTk
class InsertIMG:
def __init__(self,master,path):
self.master=master
self.path = path
def add_image(self):
load = Image.open(self.path)
img = ImageTk.PhotoImage(load)
l=Label(self.master,bg="white",image=img)
l.place(x=30,y=10)
root = Tk()
root.geometry("700x500")
fen = InsertIMG(root,'school.png')
fen.add_image()
root.mainloop()