bmi计算 python_python tkinter bmi计算

试试看bmiheight=self.heightcm.get()

print(bmiheight)

bmiweight=self.weightkg.get()

bmi= float((bmiweight)/((bmiheight / 100)**2))

self.bmi = bmi

print(bmi)

self.label1=Label(self.master,text='Your BMI is %.2f' % bmi).grid(row=5,column=0)

if bmi <= 18.5:

self.label2=Label(self.master,text='This places you in the underweight group.',fg='blue').grid(row=6,column=0)

totalindex = 'underweight'

self.totalindex = totalindex

elif bmi >18.5 and bmi <25:

self.label3=Label(self.master,text='This places you in the healthy weight group.',fg='green').grid(row=6,column=0)

totalindex = 'healthy'

self.totalindex = totalindex

elif bmi >= 25 and bmi < 30:

self.label4=Label(self.master,text='This places you in the overweight group.',fg='orange').grid(row=6,column=0)

totalindex = 'overweight'

self.totalindex = totalindex

elif bmi >=30:

self.label5=Label(self.master,text='This places you in the obese group.',fg='red').grid(row=6,column=0)

totalindex = 'obese'

self.totalindex = totalindex

if bmi >0 and bmi <999999999999999999999:

self.button6=Button(self.master,text="Store Data",fg='red',command=self.dynamic_data_entry).grid(row=8,column=0)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值