姬長信(Redy)

如何在Tkinter中添加图像?


如何在Tkinter中添加图像?

这给了我一个语法错误:

root = tk.Tk()
img = ImageTk.PhotoImage(Image.open(path))
panel = tk.Label(root, image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
root.mainloop()