计算体重python(体重计算器源代码)
如题:
@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()
,免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com