2012-06-07 170 views

回答

4

使用Tkinter PhotoImage类创建图像对象,然后将该对象分配给Label小部件的image属性。

欲了解更多信息,请参阅http://effbot.org/tkinterbook/photoimage.htm

+0

能否请你告诉我一个例子?我只需要一个带有基本图像的窗口和一个标签。该图像位于相同的目录中,并命名为image.gif。感谢 – user1402362

+0

Nvm,让它工作。谢谢! – user1402362

0

这是非常简单的:

photo = PhotoImage(file="C:\pictures\pic1.gif") 
label = Label(image=photo) 
label.pack() 
0

试试这个(对于Python 3)

from tkinter import PhotoImage 




photo = PhotoImage(file="/home/pi/pile.gif") 
lb=tkinter.Label(root,image = photo) 
lb.grid(row=4, column=1)