2015-12-14 17 views
1

我想打開一個gif文件,但只有一個白色方塊出現。我正在使用一個mac。這裏是我的代碼:如何在tkinter python中打開gif文件?

def pic(aken, heigth, width, gif): 
    name = Canvas(aken, width, height) 
    name.create_image(height/2, width/2, image = gif) 
    name.place(x=340, y=0) 
def aken(): 
    aken = Tk() 
    aken.geometry("800x600") 
    sign = PhotoImage(file='CocaCola.gif') 
    pic(aken, 120, 120, sign) 
aken() 
+0

請提供[MCVE](http://stackoverflow.com/help/mcve)。 – albert

+2

看這個http://effbot.org/pyfaq/why-do-my-tkinter-images-not-appear.htm – Zety

回答