大家好,欢迎来到IT知识分享网。
如题:
@author: 自学python的菜鸟
“””
import time
import tkinter as tk
window = tk.Tk()
window.title(‘人情世故体重测试器优化版’)
window.geometry(‘500×300’)
ts = tk.Label(window,text=’请输入您的体重’,\
bg = ‘white’,font = (‘Arinal’,12),width=30,\
height = 2)
ts.pack()
sr = tk.Entry(window,show = None,font = (‘Arinal’,12),width=30)#明文显示
sr.pack()
def cout_tz():
_sr = int(sr.get())
t.delete(1.0,tk.END)
if _sr>120:
tz = str(100+(_sr-120)*0.1)+’斤,’+’真的太标准了’
elif _sr>90:
tz = str(90+(_sr-120)*0.33)+’斤,’+’实在是太苗条了’
elif _sr>80:
tz = ‘您有点苗条了’
elif _sr>50:
tz = ‘恭喜您,这体重我想都不敢想’
elif _sr>0:
tz = ‘您这是有点飘了呀’
else:
tz = ‘阿飘都没您能飘’
t.insert(‘end’,tz)
t.update()
b_tn = tk.Button(window,text=’计算’,font = (‘Arinal’,12),width = 10,\
height = 2,command = cout_tz)
b_tn.pack()
sc_ts = tk.Label(window,text=’以下为计算结果’,\
bg = ‘white’,font = (‘Arinal’,12),width=30,\
height = 2)
sc_ts.pack()
t = tk.Text(window,font = (‘Arinal’,16),height=2)
t.pack()
window.mainloop()
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/72297.html