0

如何使用 Tkinter 在 Python 3.2 中显示图像?PIL 不起作用,所以不使用它的东西。

4

3 回答 3

4

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

有关更多信息,请参阅http://effbot.org/tkinterbook/photoimage.htm

于 2012-06-07T18:23:22.873 回答
0

这很简单:

photo = PhotoImage(file="C:\pictures\pic1.gif")
label = Label(image=photo)
label.pack()
于 2017-03-20T12:58:33.487 回答
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)
于 2017-03-30T01:55:12.123 回答