【发布时间】:2012-06-07 18:02:24
【问题描述】:
如何使用 Tkinter 在 Python 3.2 中显示图像? PIL 不工作所以不使用它的东西。
【问题讨论】:
标签: image python-3.x tkinter
如何使用 Tkinter 在 Python 3.2 中显示图像? PIL 不工作所以不使用它的东西。
【问题讨论】:
标签: image python-3.x tkinter
使用 Tkinter PhotoImage 类创建一个图像对象,然后将该对象分配给 Label 小部件的 image 属性。
欲了解更多信息,请参阅http://effbot.org/tkinterbook/photoimage.htm
【讨论】:
很简单:
photo = PhotoImage(file="C:\pictures\pic1.gif")
label = Label(image=photo)
label.pack()
【讨论】:
from tkinter import PhotoImage
photo = PhotoImage(file="/home/pi/pile.gif")
lb=tkinter.Label(root,image = photo)
lb.grid(row=4, column=1)
【讨论】: