如题:
@author: 自学python的菜鸟
"""
import time
import tkinter as tk
window = tk.Tk()
window.title('人情世故体重测试器优化版')
window.geometry('500x300')
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()
留言与评论(共有 0 条评论) “” |