0
这是到目前为止我的代码:需要帮助的Tkinter设置.gif图像
from tkinter import *
root = Tk()
root.title("Skin")
def frame():
f = Frame(root, height=350, width=400)
f.pack_propagate(0)
f.pack()
def credit():
print("")
def image1():
skin1 = PhotoImage(file='C:/Users/Xiam/Desktop/1.gif')
b = Button(root, text="Click here to see the diagram!", command=credit)
b.pack(fill=X, expand=2, anchor=N)
frame()
image1()
root.mainloop()
我知道这可能不是非常有效的,但我只是掀起这件事像两分钟。无论如何,我一直试图让我的dektop上的“1.gif”图像显示在Tkinter窗口中,并且它不起作用。完全一样。我究竟做错了什么?
...还记得要保持一个全球参考'PhotoImage',否则它就会被垃圾回收。 –