如何在Python中使用tkinter显示图像?

2024-09-30 01:26:00 发布

您现在位置:Python中文网/ 问答频道 /正文

    from tkinter import *
    from PIL import ImageTk, Image

    top = Tk()

    file ='flame2.jpg'
    filename = PhotoImage(file)

    panel=PanedWindow()
    panel = Label(top, image = filename)

    panel.pack(side = "bottom", fill = "both", expand= "yes")
    top.mainloop()

Tags: fromimageimportpiltkintertopfilenametk

热门问题