# Computer science with python project BMI Calculator (GUI)

## Computer science with python project BMI Calculator (GUI)

In this tutorial I am going to create a simple GUI based Python project called BMI Calucator ideal for CBSE Class XI-XII subject Computer science with Python. With out wasting time Let’s see how to create a simple BMI Calculator with Python, In this project I am using tkinter for GUI.

## Project Requirement

1. Python 3.X
2. Tkinter Library

### Computer science with python project BMI Calculator Full Code

```#!/usr/bin/python3
# https://www.codentricks.com

from tkinter import *
from functools import partial
import tkinter as tk

window=tk.Tk()
window.title("BMI Calculator")

def bmi(label_result, ht, wt):
ht = float((ht.get()))
wt = float((wt.get()))
ht=ht/100
bmi=float(wt / (ht*ht))
bmi=round(bmi,1)

conclusion=""

if bmi<18.5:
conclusion="Under Weight"
elif bmi>18.4 and bmi<=24.9:
conclusion="Normal"
elif bmi>24.9 and bmi<=29.9:
conclusion="Over Weight"
else:
conclusion="Obesity"

output= "BMI = "+str(bmi)+"\n" +conclusion

label_result.config(text=output)
return

ht = tk.StringVar()
wt = tk.StringVar()

labelResult = tk.Label(window)
labelResult.grid(row=4, column=0)

bmi = partial(bmi, labelResult, ht, wt)

window.geometry("400x300+10+10")
window.mainloop()

```