BMI Calculator using Python with Graphical user interface
Data science projects in pondicherry
Create New

BMI Calculator using Python with Graphical user interface

Project period

09/17/2020 - 09/30/2020




Project Category


BMI Calculator using Python with Graphical user interface
BMI Calculator using Python with Graphical user interface

The BMI module in Python has the BMI class that allows the calculations for various tasks based on weight and height. On top of it, we have a Text calculator and HTML calculator class in python that allows you to edit the calculator and use it as per your requirement. A project BMI calculator is a tool for planning activities for achieving their ideal body weight in a defined period or to maintain it throughout their entire body. A BMI calculator brings much-needed discipline to our uncontrolled food and physical management system.

Why: Problem statement

Finding a Body Mass Index is quite difficult in normal python programs. So, we are using the Tkinter package which gives a valuable calculator generator. Python allows you to edit the calculator and use it as per your requirement. A BMI calculator brings much-needed discipline to our uncontrolled food and physical management system.

How: Solution description

By getting a solution for the BMI calculator generator, we are using Python programming with Tkinter. While using the graphical user interface, we can generate a BMI calculator. The calculator with the GUI can be more interactive and reliable for the customers using the application. This BMI calculator is a daily basis using the product that precisely describes the day. Python defines an inbuilt module calculator which handles operations related to the health issues. The BMI calculator module allows output of BMI like the program and provides additional useful functions related to the body . Functions and classes defined in the Calculator module use an idealized calculator, the current calculator will display the accurate BMI (i.e., Normal, Low, High).

How is it different from competition

In the usual program, we use python code to show the BMI calculator with a certain condition. Inorder to modify the older one, we are using the graphical user interface to generate the BMI rate in the calculator. The BMI calculator is the most common thing in the world, but if we do it as the user friendly it will reach out well. The most important update and uniqueness in this project is it has special user-friendly and user interactive visuals that attract users. Python is used for making the calculator generator.

Who are your customers

This calculator generator helps to identify quick results for many of the people to save their life. The world is full of working people so everyone needs to take care of their health in order to live peacefully without disease. Obesity is the most common thing in the world, which is the foremost factor that leads to death.To prevent this and maintain our body this program is framed. It is used in the house, shops, malls, stores, restaurants, and everywhere every place in this world.

Project Phases and Schedule

Ideation  - Ideation is the process of how the project evaluation is going to be.

Software installation - In this stage, I installed all the prerequisites software and libraries for making this project. 

Python programming - Written a python program that calculates BMI of the user form the input data. Implement BMI calculator formula using python program.

Create a GUI using Tkinter - To create a new graphical user interface(Tkinter) for the use of the customers.

Program execution and technique - Program execution for the BMI generator using python program with Tkinter library.

Result - This BMI generator gives the accurate output for the BMI of users.

Resources Required

The Hardware used in this project are:

A windows 10 laptop/desktop

The Software used in this project is:

Anaconda 3 (Python 3.7) - Anaconda could be a free and ASCII text file distribution of the Python and R programming languages for scientific computing that aims to alter package management and readying.

The distribution includes data-science packages appropriate for Windows, Linux, and macOS. It was developed and maintained by Eunectes murinus, Inc., which was based on Peter Wang and Travis Oliphant in 2012. As associate Eunectes murinus, Inc. product, conjointly called Eunectes murinus Distribution or Eunectes murinus Individual Edition, whereas alternative product from the corporate square measure Eunectes murinus Team Edition and Eunectes murinus Enterprise Edition, that square measure each not free. Here we have a tendency to use the Python 3.7 version.

Project Code Code copy
/* Your file Name : BMI.ipynb */
/* Your coding Language : python */
/* Your code snippet start here */
{"metadata":{"language_info":{"name":"python","version":"3.7.8","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"\"\"\"BMI calculator\"\"\"\n\n\nclass Patient:\n    \"\"\"Creating patient class to model patient details for BMI calculation.\"\"\"\n\n    def __init__(self, name=\"UNKNOWN\", gender=\"UNKNOWN\", dob=\"UNKNOWN\", ppsn=\"TESTING\", weight=0.0, height=0.0):\n        \"\"\"Setting class attributes.\"\"\"\n = name\n        self.gender = gender\n        self.dob = dob\n        self.ppsn = ppsn\n        self.weight = weight\n        self.height = height\n\n    def calculate_bmi(self):\n        \"\"\"creating method to calculate body mass index, returns float\n        BMI= weight(kg) / ( height(m)*height(m) )\n        Example:\n        >>> Patient(weight=75, height=1.7).calculate_bmi()\n        25.95155709342561\n        \"\"\"\n\n        return float(self.weight / (self.height * self.height))\n\n    def bmi_analysis(self):\n        \"\"\"Analyse the patient's BMI:\n        < 16 underweight, < 25 healthy, < 30 overweight, 30+ obese\n        >>> Patient(height=1.83, weight=89).bmi_analysis()\n        'overweight'\n        \"\"\"\n        bmi = self.calculate_bmi()\n        if bmi < 16:\n            analysis = \"underweight\"\n        elif bmi < 25:\n            analysis = \"healthy\"\n        elif bmi < 30:\n            analysis = \"overweight\"\n        else:\n            analysis = \"obese\"\n        return analysis\n\n    def generate_report(self):\n        \"\"\"\"Creating method to generate report to file containing patient details and BMI results.\"\"\"\n        report_file = open(self.ppsn, \"w\")\n        print(\"PATIENT REPORT\", file=report_file)\n        print(\"-\" * 30, \"\\n\", file=report_file)\n        print(\"Patient name:\\t\",, file=report_file)\n        print(\"Patient gender:\\t\", self.gender, file=report_file)\n        print(\"Patient dob: \\t\", self.dob, file=report_file)\n        print(\"Patient PPSN:\\t\", self.ppsn, file=report_file)\n        print(\"Patient weight:\\t\", self.weight, \"kg\", file=report_file)\n        print(\"Patient height:\\t\", self.height, \"m\", file=report_file)\n        print(\"Patient BMI: \\t\", round(self.calculate_bmi(), 1), file=report_file)\n        print(\"BMI Analysis: \\t\", self.bmi_analysis(), file=report_file)\n        report_file.close()\\nfrom bmi import *\nimport tkinter\n\n\ndef calculate():\n    user = Patient(weight=float(weight_entry.get()),\n                   height=float(height_entry.get()))\n    bmi_label.configure(text=\"Your BMI is \" +\n                             str(round(user.calculate_bmi(), 2))\n                             + \" which is \"\n                             + user.bmi_analysis() + \".\")\n\ninterface = tkinter.Tk()\ninterface.title(\"BMI Calculator\")\ninterface.minsize(150, 150)\n\n# declare labels\nheight_label = tkinter.Label(text=\"Height (m)\")\nweight_label = tkinter.Label(text=\"Weight (Kg)\")\nbmi_label = tkinter.Label()\n\n# declare entry boxes\nheight_entry = tkinter.Entry(justify=\"right\")\nweight_entry = tkinter.Entry(justify=\"right\")\n\n# declare buttons\ncalculate_button = tkinter.Button(text=\"Calculate\", command=calculate)\n\n# place widgets on grid\nheight_label.grid(row=0, column=0, padx=10, pady=10)\nheight_entry.grid(row=0, column=1, padx=10, pady=10)\nweight_label.grid(row=1, column=0, padx=10, pady=10)\nweight_entry.grid(row=1, column=1, padx=10, pady=10)\nbmi_label.grid(row=2, column=0, columnspan=2, padx=10, pady=10)\ncalculate_button.grid(row=4, column=1, padx=10, pady=10)\n\n# interface loop\ntkinter.mainloop()","metadata":{},"execution_count":null,"outputs":[]}]}
View on Github
BMI Calculator


Leave a Comment

Post a Comment

Are you Interested in this project?

Do you need help with a similar project? We can guide you. Please Click the Contact Us button.

Contact Us

Social Sharing