python第十一课——图形界面载入gif图片并用按钮切换

2019-04-15 13:35发布

from Tkinter import * def Get():         inp=ent.get()
       
        pic=PhotoImage(file = inp)
        tem=can.create_image(250,200, image = pic)
 
root = Tk()
root.geometry('600x600+270+50') lab=Label(root, text='Name of the picture',font=("Helvatica",20))
ent=Entry(root, bg='white',font=("Helvatica",20),width=30) button =Button(root,text='Enter',width=10,height=2,command=Get)
can = Canvas(root,width='500',height='400', bg='white') pic=PhotoImage(file='wo.GIF')
tem=can.create_image(0,0,image=pic) ent.focus()
lab.pack(pady=10)
ent.pack(pady=10)
button.pack(ancho=E)
can.pack() root.mainloop()