1
我正在嘗試顯示圖像。使用tkinter,ttk和python3顯示.gif圖像
from tkinter import *
from tkinter import ttk
root = Tk()
myimage = PhotoImage(file='world.gif')
ttk.Label(root, image=myimage)
root.mainloop()
當我運行這個,我希望看到我的形象。但我只看到一幅純色的灰色影像。 任何幫助表示讚賞。
非常感謝Adam。我必須在變量中引用ttk.Label:'label = ttk.Label(root,image = myimage)',然後使用pack方法 'label.pack()' – hedgesketch