我的GIF是凍結' - '(不顯示/動畫,但工作tkinter)。我嘗試了所有其他方式,但仍然無法正常工作,代碼:Tkinter GIF不顯示
import tkinter as tk
from tkinter import *
def animate(self):
global pic
pic = PhotoImage(file="/home/arnaldo/Desktop/b.gif")
print("called1")
self.canvas = Canvas(width=350, height=233, bg='white')
self.canvas.pack(expand=YES, fill=BOTH)
self.canvas.create_image((0, 0), image=pic, anchor=NW)
class run(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
animate(self)
run().mainloop()
您的問題是您沒有看到任何圖像,或者您看到一張圖像沒有生成動畫? –