如題:
@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()
,更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!