【发布时间】:2017-10-30 20:56:06
【问题描述】:
from tkinter import *
photo = PhotoImage(file="C:\Temp\test\computer.gif")
lbl = Label(root, image=photo, height="10", width="20").pack
我完全不知道为什么这不起作用:_tkinter.TclError: couldn't recognize data in image file "C:\Temp\test\computer.gif.
【问题讨论】:
-
请记住,在上面的代码中,您的
lbl不是一个标签对象,而是一个函数对象。如果你想调用pack方法,你需要在一个单独的行中进行。
标签: python windows tkinter gif