Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 80f96ab

Browse files
Add files via upload
1 parent 3e60256 commit 80f96ab

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

‎bmi cal/BMI_Calculator.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
from tkinter import*
2+
3+
root = Tk()
4+
root.geometry("1350x650+0+0")
5+
root.resizable(0,0)
6+
root.title("BMI CALCULATOR")
7+
8+
def BMI_Cal():
9+
Bheight = float(var2.get())
10+
Bweight = float(var1.get())
11+
BMI = str('%.2f' %(Bweight / (Bheight * Bheight)))
12+
labelBMIResult.config(text = BMI)
13+
14+
15+
var1 = DoubleVar()
16+
var2 = DoubleVar()
17+
18+
Tops = Frame(root, width = 1350, height = 50, bd = 8, relief = "raise")
19+
Tops.pack(side = TOP)
20+
21+
f1 = Frame(root, width = 600, height = 600, bd = 8, relief = "raise")
22+
f1.pack(side = LEFT)
23+
24+
f2 = Frame(root, width = 300, height = 700, bd = 8, relief = "raise")
25+
f2.pack(side = RIGHT)
26+
27+
f1a = Frame(f1, width = 600, height = 200, bd = 20, relief = "raise")
28+
f1a.pack(side = TOP)
29+
f1b = Frame(f1, width = 600, height = 600, bd = 20, relief = 'raise')
30+
f1b.pack(side=TOP)
31+
32+
label1Title = Label(Tops, text = " BODY MASS INDEX ", padx = 16, pady = 16, bd = 16, fg = '#000000', font = ("arial", 54, 'bold'), bg = "powder blue", relief = 'raise', width = 32, height = 1)
33+
label1Title.pack()
34+
35+
labelweight = Label(f1a, text = "Select Weight in Kilograms", font =('arial', 20, 'bold'), bd = 20).grid(row = 0, column = 0)
36+
Bodyweight = Scale(f1a, variable = var1, from_ = 1, to = 500, length = 880, tickinterval = 30, orient = HORIZONTAL)
37+
Bodyweight.grid(row = 1, column = 0)
38+
39+
labelheight = Label(f1b, text = "Enter Height in Meters Square", font =('arial', 20, 'bold'), bd = 20).grid(row = 0, column = 0)
40+
textheight = Entry(f1b, textvariable = var2, font = ('arial', 16, 'bold'), bd = 16, width = 22, justify = 'center')
41+
textheight.grid(row = 1, column = 0)
42+
43+
labelBMIResult = Label(f1b, padx = 16, pady = 16, bd = 16, fg = '#000000', font = ('arial', 30, 'bold'), bg = 'sky blue', relief = 'sunk', width = 34, height = 1)
44+
labelBMIResult.grid(row = 2, column = 0)
45+
46+
labelBMITable = Label(f2, font = ("arial", 20, 'bold'), text = 'BMI Table').grid(row = 0, column = 0)
47+
txtlabelBMITable = Text(f2, height = 12, width = 38, bd = 16, font = ("arial", 12, 'bold'))
48+
txtlabelBMITable.grid(row = 1, column = 0)
49+
50+
txtlabelBMITable.insert(END, 'Meaning \t\t' + "BMI \n\n")
51+
txtlabelBMITable.insert(END, 'Normal weight \t\t' + "19-24 \n\n")
52+
txtlabelBMITable.insert(END, 'Overwight \t\t' + "25-29,9 \n\n")
53+
txtlabelBMITable.insert(END, 'Obesity level I \t\t' + "30-34, 9 \n\n")
54+
txtlabelBMITable.insert(END, 'Obesity level II \t\t' + "35-39, 9\n\n")
55+
txtlabelBMITable.insert(END, 'Obesity level III \t\t' + ">= 40\n\n")
56+
57+
btnBMI = Button(f2, text = "Click to \nCheck Your \nBMI", padx = 8, pady = 8, bd = 12, width = 21, font = ("arial", 20, 'bold'), height = 3, command = BMI_Cal)
58+
btnBMI.grid(row = 2, column = 0)
59+
60+
root.mainloop()
61+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /