BMI Calculator in Python with Source Code
The BMI Calculator in Python is developed in python programming language and it is a desktop application. This system is created using tkinter and graphical user interface. The BMI Calculator in Python is free to download the open source code. The task is for the client advantageous, for checking your BMI. With the BMI esteem, you can check whether you have a solid weight or not. The undertaking record contains a python content (BMI.py).
Discussing the highlights of this BMI Calculator framework, this python application is intended to figure the BMI estimation of client by entering the estimation of their weight and tallness. You can simply need to choose the weight and enter the stature you need to include in estimations and snap the catch for the outcome. It is fit for dealing with a wide range of exemptions.
Anyway if you want level up your knowledge in programming especially games in python, try this new article I’ve made for you Code For Game in Python: Python Game Projects With Source Code
Before you start creating this BMI Calculator in Python, make sure that you have PyCharm IDE installed in your computer.
Steps on how to create BMI Calculator in Python
BMI Calculator in Python with Source Code
- Step 1: Create a project name.
First when you finished installed the Pycharm IDE in your computer, open it and then create a “project name” after creating a project name click the “create” button.
- Step 2: Create a python file.
Second after creating a project name, “right click” your project name and then click “new” after that click the “python file“.
- Step 3: Name your python file.
Third after creating a python file, Name your python file after that click “enter“.
- Step 4: The actual code.
This is the actual coding on how to create BMI Calculator in Python, and you are free to copy this code and download the full source code given below.
Importing Tkinter Module
In the code given below, which is for the function for importing tkinter. Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications.
1 |
from tkinter import * |
This module is for the BMI calculator
In the code given below, which is for the function for BMI calculator.
1 2 3 4 5 |
def BodyMassIndex_Calculator(): BMI_Height = float(variable2.get()) BMI_Weight = float(variable1.get()) BodyMassIndex = str('%.2f' % (BMI_Weight / (BMI_Height * BMI_Height))) lbl_res_bmi.config(text=BodyMassIndex) |
This module is for the design for main window
In the code given below, which is for the function for the design of BMI screen windows. You can see the frame, and the label use in the system.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
Tops = Frame(application, width=1350, height=50, bd=8, relief="raise") Tops.pack(side=TOP) frame1 = Frame(application, width=600, height=600, bd=8, relief="raise") frame1.pack(side=LEFT) frame2 = Frame(application, width=300, height=700, bd=8, relief="raise") frame2.pack(side=RIGHT) frame1A = Frame(frame1, width=600, height=200, bd=20, relief="raise") frame1A.pack(side=TOP) frame1B = Frame(frame1, width=600, height=600, bd=20, relief='raise') frame1B.pack(side=TOP) lbl_T1 = Label(Tops, text=" BODY MASS INDEX ", padx=16, pady=16, bd=16, fg='#000000', font=("arial", 54, 'bold'), bg="navajo white", relief='raise', width=32, height=1) lbl_T1.pack() lbl_w = Label(frame1A, text="Select Weight in Kilograms", font=('arial', 20, 'bold'), bd=20).grid(row=0, column=0) b_w = Scale(frame1A, variable=variable1, from_=1, to=500, length=880, tickinterval=30, orient=HORIZONTAL) b_w.grid(row=1, column=0) lbl_h = Label(frame1B, text="Enter Height in Meters Square", font=('arial', 20, 'bold'), bd=20).grid(row=0, column=0) t_h = Entry(frame1B, textvariable=variable2, font=('arial', 16, 'bold'), bd=16, width=22, justify='center') t_h.grid(row=1, column=0) lbl_res_bmi = Label(frame1B, padx=16, pady=16, bd=16, fg='#000000', font=('arial', 30, 'bold'), bg='navajo white', relief='sunk', width=34, height=1) lbl_res_bmi.grid(row=2, column=0) |
This module is the design for BMI table
In the code given below, which is for the function for the design of BMI table.
1 2 3 4 5 6 7 8 9 10 |
lbl_table_bmi = Label(frame2, font=("arial", 20, 'bold'), text='BMI Table').grid(row=0, column=0) bmi_tab_text_lbl = Text(frame2, height=12, width=38, bd=16, font=("arial", 12, 'bold')) bmi_tab_text_lbl.grid(row=1, column=0) bmi_tab_text_lbl.insert(END, 'Meaning \t\t' + "BMI \n\n") bmi_tab_text_lbl.insert(END, 'Normal weight \t\t' + "19-24 \n\n") bmi_tab_text_lbl.insert(END, 'Overwight \t\t' + "25-29,9 \n\n") bmi_tab_text_lbl.insert(END, 'Obesity level I \t\t' + "30-34, 9 \n\n") bmi_tab_text_lbl.insert(END, 'Obesity level II \t\t' + "35-39, 9\n\n") bmi_tab_text_lbl.insert(END, 'Obesity level III \t\t' + ">= 40\n\n") |
Complete Source Code for BMI Calculator in Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
from tkinter import * application = Tk() application.geometry("1350x650+0+0") application.resizable(0, 0) application.title("BMI CALCULATOR") def BodyMassIndex_Calculator(): BMI_Height = float(variable2.get()) BMI_Weight = float(variable1.get()) BodyMassIndex = str('%.2f' % (BMI_Weight / (BMI_Height * BMI_Height))) lbl_res_bmi.config(text=BodyMassIndex) variable1 = DoubleVar() variable2 = DoubleVar() Tops = Frame(application, width=1350, height=50, bd=8, relief="raise") Tops.pack(side=TOP) frame1 = Frame(application, width=600, height=600, bd=8, relief="raise") frame1.pack(side=LEFT) frame2 = Frame(application, width=300, height=700, bd=8, relief="raise") frame2.pack(side=RIGHT) frame1A = Frame(frame1, width=600, height=200, bd=20, relief="raise") frame1A.pack(side=TOP) frame1B = Frame(frame1, width=600, height=600, bd=20, relief='raise') frame1B.pack(side=TOP) lbl_T1 = Label(Tops, text=" BODY MASS INDEX ", padx=16, pady=16, bd=16, fg='#000000', font=("arial", 54, 'bold'), bg="navajo white", relief='raise', width=32, height=1) lbl_T1.pack() lbl_w = Label(frame1A, text="Select Weight in Kilograms", font=('arial', 20, 'bold'), bd=20).grid(row=0, column=0) b_w = Scale(frame1A, variable=variable1, from_=1, to=500, length=880, tickinterval=30, orient=HORIZONTAL) b_w.grid(row=1, column=0) lbl_h = Label(frame1B, text="Enter Height in Meters Square", font=('arial', 20, 'bold'), bd=20).grid(row=0, column=0) t_h = Entry(frame1B, textvariable=variable2, font=('arial', 16, 'bold'), bd=16, width=22, justify='center') t_h.grid(row=1, column=0) lbl_res_bmi = Label(frame1B, padx=16, pady=16, bd=16, fg='#000000', font=('arial', 30, 'bold'), bg='navajo white', relief='sunk', width=34, height=1) lbl_res_bmi.grid(row=2, column=0) lbl_table_bmi = Label(frame2, font=("arial", 20, 'bold'), text='BMI Table').grid(row=0, column=0) bmi_tab_text_lbl = Text(frame2, height=12, width=38, bd=16, font=("arial", 12, 'bold')) bmi_tab_text_lbl.grid(row=1, column=0) bmi_tab_text_lbl.insert(END, 'Meaning \t\t' + "BMI \n\n") bmi_tab_text_lbl.insert(END, 'Normal weight \t\t' + "19-24 \n\n") bmi_tab_text_lbl.insert(END, 'Overwight \t\t' + "25-29,9 \n\n") bmi_tab_text_lbl.insert(END, 'Obesity level I \t\t' + "30-34, 9 \n\n") bmi_tab_text_lbl.insert(END, 'Obesity level II \t\t' + "35-39, 9\n\n") bmi_tab_text_lbl.insert(END, 'Obesity level III \t\t' + ">= 40\n\n") BMI_BUTTON = Button(frame2, text="Click to \nCheck Your \nBMI", padx=8, pady=8, bd=12, bg='navajo white', width=21, font=("arial", 20, 'bold'), height=3, command=BodyMassIndex_Calculator) BMI_BUTTON.grid(row=2, column=0) application.mainloop() |
Run Quick Virus Scan for secure Download
Run Quick Scan for safe DownloadDownloadable Source Code Below
I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.
Summary
That’s how you create BMI Calculator in Python in your projects. You can always expand and try different ways in implementing the BMI Calculator in Python in your Python projects.
In this BMI Calculator in Python is free to download. This project is good for the student who want to learn python programming because this project contains a Graphical User Interface (GUI) and a users friendly. It is easy to understand and manipulate this project and use for education purpose only.
Related Articles
- Loan Calculator in Python with Source Code
- Python Code For Food Ordering System
- College Management System in Python with Source Code
- Ticket Booking System In Python With Source Code
- Car Booking System in Python with Source Code
- Multiplication Table In Python With Source Code
- Flight Management System in Python with Source Code
- Book Store Management System Python Project With Source Code
Inquiries
If you have any questions or suggestions about BMI Calculator in Python with Source Code , please feel free to leave a comment below.