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

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-28 17:44   24   0

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()

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP