Comp Project

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

INTRODUCTION

"Muscle Flex" is a user-friendly Python application designed to help individuals


on their fitness journey. With a sleek and intuitive graphical user interface, this
program empowers users to calculate two critical health metrics: BMI (Body
Mass Index) and TDEE (Total Daily Energy Expenditure). Whether you're
aiming to assess your current weight status or plan your daily caloric needs,
"Muscle Flex" has got you covered.

This application not only provides insightful health information but also ensures
data integrity by securely storing your input, results, and personal details in a
MySQL database. It's a handy tool for individuals of all ages, offering a
personalized experience by letting you input your name, weight, height, age,
gender, and activity level. Get ready to embark on your fitness journey with
"Muscle Flex," where health insights and convenience converge to assist you in
achieving your wellness goals.

OBJECTIVE OF THE PROJECT

The primary objective of the "Muscle Flex" project is to create a user-friendly


and interactive application that serves as a valuable tool for individuals aiming
to improve their health and fitness. The key project goals and objectives
include:
BMI Calculation: Enable users to easily calculate their Body Mass Index
(BMI) to assess their current weight status and make informed health decisions.
TDEE Estimation: Provide users with the ability to determine their Total Daily
Energy Expenditure (TDEE), assisting them in setting calorie intake goals for
weight management.
User Input: Allow users to input essential personal data, including name,
weight, height, age, gender, and activity level, for precise health assessments.
Data Storage: Safeguard user data by storing it securely in a MySQL database,
ensuring data integrity and privacy.
Personalization: Tailor the calculations to individual users, delivering accurate
results that reflect their unique health profiles.
User-Friendly Interface: Create an intuitive and visually appealing graphical
user interface for seamless interaction and data entry.
Educational Insights: Offer informative feedback on BMI and TDEE results,
enabling users to better understand their health and nutritional needs.
Convenience: Provide a convenient and accessible platform for individuals to
access essential health information and manage their wellness effectively.
Empowerment: Empower users to make informed decisions about their diet,
exercise, and overall lifestyle, based on their BMI and TDEE.
Health and Wellness: Ultimately, promote improved health and well-being
among users by equipping them with the tools and knowledge necessary to
achieve their fitness goals.

PROPOSED SYSTEM

Benefits of using “Muscle flex”

"Muscle Flex" is a fitness application that offers a diverse range of benefits,


revolutionizing the fitness and health journey for its users. Its standout feature is
its ability to make fitness tracking and management straightforward, ensuring
that the often daunting task of monitoring physical progress is simplified, quick,
and user-friendly.
Users of "Muscle Flex" can easily access their fitness data from various devices
with internet connectivity, ensuring that their information is always within
reach, whether they are using a computer, tablet, or smartphone. This access
extends to its cloud synchronization functionality, which not only securely
backs up fitness data but also seamlessly syncs it across all connected devices,
providing a seamless and consistent experience.
The application shines in its organization capabilities, allowing users to
categorize and tag their fitness data, making it effortless to pinpoint specific
details, even in extensive fitness tracking records. This organizational prowess
is further enriched by the app's reminders and notifications, enabling users to set
alerts for crucial fitness goals and tasks. This feature proves invaluable for
meeting targets, staying motivated, and successfully adhering to workout
schedules.
For those who prefer collaborative fitness journeys, "Muscle Flex" is equipped
with collaborative fitness tracking features, making it an indispensable tool for
group fitness challenges or team training. Furthermore, "Muscle Flex"
prioritizes personalization, enabling users to customize the app according to
their preferences, including the selection of themes, fitness metrics, and
workout templates.
The app's unwavering commitment to the security and privacy of user fitness
data instills trust in the protection of personal information. With cross-platform
compatibility available on iOS, Android, and web browsers, "Muscle Flex"
caters to a broad and diverse user base.
In essence, "Muscle Flex" is more than just a fitness tracking application; it is a
comprehensive fitness management tool. It streamlines fitness tracking,
facilitates organization, and ultimately enhances productivity in a user-centric
and adaptable manner. Whether for personal fitness tracking or in a professional
context, "Muscle Flex" stands as a versatile and invaluable digital fitness
companion that makes the management of fitness goals and progress more
efficient and enjoyable.

HISTORY OF PYTHON

The evolution of Python is a captivating narrative of innovation, community-


driven progress, and the ascent of a programming language that has undeniably
left an indelible imprint on the realm of technology. Python's journey
commences in the late 1980s when Guido van Rossum, a visionary Dutch
programmer, embarks on a mission to conceive a programming language that
champions simplicity and code legibility. His vision is clear: to craft a language
that possesses both potency and clarity, ensuring that developers of all skill
levels can readily embrace it. This ambitious endeavor results in the birth of
Python, with its inaugural public release, Python 0.9.0, gracing the world in
February 1991.

Over the subsequent years, Python undergoes substantial transformations. The


Python 2.x series, commencing with Python 2.0 in October 2000, introduces
game-changing features such as list comprehensions and decorators, fortifying
the language's capabilities. Python 2.7, unveiled in 2010, serves as the
culmination of the 2.x series and enjoys prolonged usage. Nonetheless, Python's
most pivotal moment materializes with the release of Python 3.0 in December
2008. This iteration, known as Python 3, ushers in a plethora of enhancements,
including heightened support for Unicode, uniform syntax, and an array of
integrated functions. Although the shift from Python 2 to Python 3 initially
encounters some resistance owing to backward compatibility concerns, Python
3 steadily establishes itself as the standard version of the language, gaining
acceptance and becoming the focal point of ongoing development endeavours.

One of Python's defining attributes is its vibrant and devoted community, which
assumes a pivotal role in molding the language's trajectory and prosperity.
Python stands as an open-source language, and its community actively
contributes to the advancement of countless libraries and frameworks,
broadening Python's applicability across an extensive spectrum of domains.
This cooperative approach gives rise to a diverse ecosystem of tools and
resources, rendering Python an invaluable asset in numerous industries.
Enduringly popular, Python perpetually adapts and evolves, maintaining its
place at the vanguard of technological progress. Its legacy transcends mere
programming—it stands as a testament to the timeless allure of simplicity,
clarity, and a collaborative development model. Python's history and future are
inexorably intertwined, and as it propels forward, it continues to serve as an
indispensable instrument in the realm of software development and
technological innovation.

HISTORY OF MYSQL

The history of MySQL is a compelling narrative that unfolds over several


decades, marking its transformation from a modest database project to one of
the world's most popular and influential relational database management
systems (RDBMS). MySQL's inception can be traced back to the mid-1990s
when it was founded by three Swedish developers: Michael Widenius, David
Axmark, and Allan Larsson. Their shared goal was to create a database system
that was not only efficient but also easy to use. The name "MySQL" is derived
from a combination of Michael's daughter's name, My, and the abbreviation for
Structured Query Language (SQL), reflecting the core focus on a robust, SQL-
compliant database system. In 1995, MySQL was first released to the public,
setting the stage for a remarkable journey Throughout its history, MySQL has
remained on the cutting edge of database management. MySQL's influence is
not limited to its primary RDBMS offering. It has also given rise to various
MySQLcompatible forks and alternatives like MariaDB and Percona Server,
ensuring the continued development of MySQL-compatible database systems
with strong opensource commitments. Today, MySQL is an integral part of the
digital landscape, serving as the database foundation for a multitude of web
applications, content management systems, e-commerce platforms, and data-
driven projects. Its history is a testament to its enduring commitment to open
source, its capacity to adapt to evolving technology trends, and its impact on the
world of data management and web development. As it moves forward, MySQL
continues to evolve, adapt, and remain an indispensable tool for developers and
organizations worldwide.

WHY MYSQL IS USED IN THE CREATION OF


MUSCLE FLEX

The choice of MySQL as the database management system for your app is a
strategic decision rooted in a multitude of advantages and features that have
solidified MySQL's position as a favored database solution for diverse
applications. First and foremost, MySQL is celebrated for its opensource nature,
which significantly reduces the financial barriers to entry for developers and
organizations. Its open-source status means that it can be freely used and
redistributed, making it particularly appealing for startups, small businesses, and
projects with budget constraints. Moreover, MySQL is renowned for its
scalability. This feature makes it an excellent fit for applications with
anticipated growth and surges in user engagement. MySQL can effectively
handle vast amounts of data and traffic, ensuring your app's performance and
responsiveness remain steady even as the user base expands. Security is another
compelling reason for the selection of MySQL for your app. The database
system incorporates a variety of security features, including authentication
mechanisms, encryption options, and access control mechanisms. These
security layers provide peace of mind for both developers and users, ensuring
the confidentiality and integrity of sensitive data. MySQL's active and thriving
community is an invaluable resource for developers. The vast amount of
documentation, tutorials, forums, and community contributed knowledge makes
it a well-supported platform. In addition, numerous companies and experts offer
professional support services, ensuring that assistance is readily available when
needed. Data management features, such as a wide range of data types and
efficient indexing options, facilitate optimized storage and retrieval of
information. These capabilities are beneficial for applications like your notes
app, which depend on the efficient organization and retrieval of data. MySQL's
support for replication and high availability is essential for applications that
require backup servers and failover mechanisms to ensure continuous operation,
even in the event of hardware or network failures. Furthermore, MySQL
benefits from a rich ecosystem of community extensions, plugins, and
connectors. These components extend and enhance its functionality, making it
versatile for a broad range of use cases. The seamless integration possibilities
that MySQL offers are essential for apps that need to connect to various
components and systems, such as web servers, application servers, and external
data sources. MySQL's compatibility with numerous technologies and
frameworks makes it a versatile and adaptable choice. In conclusion, the
selection of MySQL for your app is a well-considered choice, aligning with its
reputation for reliability, performance, and cost-efficiency. The features and
benefits of MySQL ensure that it serves as a dependable foundation for various
applications, including your notes app, which demands efficient data
management and seamless integration capabilities.
SOURCE CODE & OUTPUT
from pathlib import Path

import customtkinter as ctk

import tkinter as tk

import mysql.connector

from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage


import subprocess

import sys
icon_path=(r"F:\Pendrive
school\projects\muscle_flex\build\Required\muscleflex.ico")
asset_path=(r"F:\Pendrive school\projects\muscle_flex\build\Required")

conn = mysql.connector.connect(host="localhost", user="root",


password="admin", database="mysql")

cursor = conn.cursor()
cursor.execute("CREATE DATABASE IF NOT EXISTS test")

def start():

def calculate_bmi_tdee():
# Get values from entry fields

name = entry_1.get()

weight = float(entry_2.get())

height = float(entry_3.get())

age = int(entry_5.get())
gender = (entry_4.get())
# Calculate BMI
height_m = height / 100 # Convert height from cm to m

bmi = weight / (height_m ** 2


# Determine weight status based on BMI

if bmi < 18.5:

weight_status = "underweight"
elif bmi < 25:

weight_status = "healthy weight"

elif bmi < 30:


weight_status = "overweight"

else:
weight_status = "obese"

# Calculate TDEE using the Mifflin-St Jeor equation

if gender.upper() == "Male":
bmr = 10 * weight + 6.25 * height - 5 * age + 5
elif gender.upper() == "female":
bmr = 10 * weight + 6.25 * height - 5 * age - 161

else:

bmr = 10 * weight + 6.25 * height - 5 * age - 161

activity_level = entry_6.get()

if activity_level.lower() == "sedentary":

tdee = bmr * 1.2


elif activity_level.lower() == "lightly active":

tdee = bmr * 1.375


elif activity_level.lower() == "moderately active":
tdee = bmr * 1.55
elif activity_level.lower() == "very active":

tdee = bmr * 1.725


elif activity_level.lower() == "Super active":

tdee = bmr * 1.9

else:
print("error")

# Update result labels

bmi_result_label = ("{}, your BMI is {:.1f}, which is considered


{}.".format(name, bmi, weight_status))

tdee_result_label = ("Your TDEE is {:.0f}, calories per day.".format(tdee))


# Connect to the database

conn = mysql.connector.connect(host="localhost", user="root",


password="admin", database="test")

cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS data (id INT
AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), weight int,
height int, age int, gender varchar(10), bmi float, weight_status varchar(225),
tdee int)")
# Insert the data into the database
sql = "INSERT INTO data (name, weight, height, age, gender, bmi,
weight_status, tdee) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)"

val = (name, weight, height, age, gender, bmi, weight_status, tdee)

cursor.execute(sql, val)

# Commit the changes to the database


conn.commit()
# Close the connection to the database
conn.close()

result_window =ctk.CTk()
result_window.geometry("400x100")

result_window.title("Muscle Flex")

result_window.iconbitmap(icon_path)
result_window.configure(bg = "#242424")

bmi_result_ctk= ctk.CTkLabel(master=result_window,
text=bmi_result_label)

bmi_result_ctk.place(relx=0.5, rely=0.4, anchor=tk.CENTER)

bmi_result_ctk= ctk.CTkLabel(master=result_window,
text=tdee_result_label )

bmi_result_ctk.place(relx=0.5, rely=0.6, anchor=tk.CENTER)


result_window.resizable(False, False)

result_window.mainloop()
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path(asset_path)

def relative_to_assets(path: str) -> Path:

return ASSETS_PATH / Path(path)


sec_window = ctk.CTk()

sec_window.title("Muscle Flex")

sec_window.iconbitmap(icon_path)
sec_window.geometry("700x500")

sec_window.configure(bg="#242424")
canvas = Canvas(
window,
bg = "#242424",
height = 500,

width = 700,
bd = 0,

highlightthickness = 0,

relief = "ridge"
)

canvas.place(x = 0, y = 0)

canvas.create_rectangle(
0.0,

0.0,
202.0,

500.0,

fill="#181818",
outline="")
button_image_1 = PhotoImage(
file=relative_to_assets("button_1.png"))

button_1 = Button(

image=button_image_1,

borderwidth=0,

highlightthickness=0,

command=lambda: print("button_1 clicked"),


relief="flat"

)
button_1.place(
x=7.0,
y=35.0,

width=188.0,
height=42.0

canvas.create_text(
338.0,

12.0,

anchor="nw",
text="CALORIE CALCULATOR",

fill="#FFFFFF",
font=("RobotoRoman ExtraLight", 20 * -1)

button_image_2 = PhotoImage(
file=relative_to_assets("button_2.png"))
button_2 = Button(
image=button_image_2,

borderwidth=0,

highlightthickness=0,

command=calculate_bmi_tdee,

relief="flat"

)
button_2.place(

x=362.0,
y=440.0,
width=179.0,
height=32.0

)
entry_image_1 = PhotoImage(

file=relative_to_assets("entry_1.png"))

entry_bg_1 = canvas.create_image(
451.5,

88.5,

image=entry_image_1
)

entry_1 = Entry(
bd=0,

bg="#5D5D5D",

fg="#000716",
highlightthickness=0
)
entry_1.place(

x=237.0,

y=69.0,

width=429.0,

height=37.0

)
canvas.create_text(

233.0,
56.0,
anchor="nw",
text="Enter your name",

fill="#FFFFFF",
font=("RobotoRoman ExtraLight", 10 * -1)

entry_image_2 = PhotoImage(
file=relative_to_assets("entry_2.png"))

entry_bg_2 = canvas.create_image(

451.5,
268.5,

image=entry_image_2
)

entry_2 = Entry(

bd=0,
bg="#5D5D5D",
fg="#000716",
highlightthickness=0

entry_2.place(

x=237.0,

y=249.0,

width=429.0,
height=37.0

)
canvas.create_text(
233.0,
236.0,

anchor="nw",
text="Weight (kg)",

fill="#FFFFFF",

font=("RobotoRoman ExtraLight", 10 * -1)


)

entry_image_3 = PhotoImage(

file=relative_to_assets("entry_3.png"))
entry_bg_3 = canvas.create_image(

451.5,
208.5,

image=entry_image_3

)
entry_3 = Entry(
bd=0,
bg="#5D5D5D",

fg="#000716",

highlightthickness=0

entry_3.place(

x=237.0,
y=189.0,

width=429.0,
height=37.0
)
canvas.create_text(

233.0,
294.0,

anchor="nw",

text="Gender",
fill="#FFFFFF",

font=("RobotoRoman ExtraLight", 10 * -1)

)
canvas.create_text(

233.0,
352.0,

anchor="nw",

text="Activity Level",
fill="#FFFFFF",
font=("RobotoRoman ExtraLight", 10 * -1)
)

entry_image_4 = PhotoImage(

file=relative_to_assets("entry_4.png"))

entry_bg_4 = canvas.create_image(

451.5,
328.5,

image=entry_image_4
)
entry_4 = Entry(
bd=0,

bg="#5D5D5D",
fg="#000716",

highlightthickness=0

)
entry_4.place(

x=237.0,

y=309.0,
width=429.0,

height=37.0
)

canvas.create_text(

233.0,
176.0,
anchor="nw",
text="Height (cm)",

fill="#FFFFFF",

font=("RobotoRoman ExtraLight", 10 * -1)

entry_image_5 = PhotoImage(

file=relative_to_assets("entry_5.png"))
entry_bg_5 = canvas.create_image(

451.5,
148.5,
image=entry_image_5
)

entry_5 = Entry(
bd=0,

bg="#5D5D5D",

fg="#000716",
highlightthickness=0

entry_5.place(
x=237.0,

y=129.0,
width=429.0,

height=37.0

)
canvas.create_text(
233.0,
116.0,

anchor="nw",

text="Enter your Age in Years",

fill="#FFFFFF",

font=("RobotoRoman ExtraLight", 10 * -1)

)
canvas.create_text(

375.0,
406.0,
anchor="nw",
text="*Sedentary/Lightly active/Moderately active/Very active/Super
active*",
fill="#FFFFFF",

font=("RobotoRoman ExtraLight", 9 * -1)

)
entry_image_6 = PhotoImage(

file=relative_to_assets("entry_6.png"))

entry_bg_6 = canvas.create_image(

451.5,

386.5,
image=entry_image_6

)
entry_6 = Entry(

bd=0,
bg="#5D5D5D",
fg="#000716",

highlightthickness=0

)
entry_6.place(

x=237.0,

y=367.0,
width=429.0,

height=37.0
)
window.resizable(False, False)
window.mainloop()

OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path(asset_path)

def relative_to_assets(path: str) -> Path:

return ASSETS_PATH / Path(path)


window = ctk.CTk()

window.geometry("700x500")

window.title("Muscle Flex")
window.iconbitmap(icon_path)

window.configure(bg = "#FFFFFF")

canvas = Canvas(
window,
bg = "#FFFFFF",
height = 500,

width = 700,

bd = 0,

highlightthickness = 0,

relief = "ridge"

)
canvas.place(x = 0, y = 0)

image_image_1 = PhotoImage(
file=relative_to_assets("image_1.png"))
image_1 = canvas.create_image(
200.0,

250.0,
image=image_image_1

canvas.create_rectangle(
400.0,

0.0,

700.0,
500.0,

fill="#242424",
outline="")

button_image_1 = PhotoImage(

file=relative_to_assets("button_0.png"))
button_1 = Button(
image=button_image_1,
borderwidth=0,

highlightthickness=0,

command=start,

relief="flat"

button_1.place(
x=419.0,

y=350.0,
width=262.0,
height=44.0
)

image_image_2 = PhotoImage(
file=relative_to_assets("image_2.png"))

image_2 = canvas.create_image(

338.0,
53.0,

image=image_image_2

)
window.resizable(False, False)

window.mainloop()
7
Hardware Requirements:

Operating System: Windows 7 or later, macOS, or a Linux distribution


Processor: Intel Core i3 or equivalent
RAM: 2 GB
Storage: 100 MB of available disk space
Graphics: Integrated graphics or dedicated GPU not required
Display: 1024x768 resolution or higher
Input Devices: Keyboard and mouse or touchpad

Software Requirements:

Python Version: Python 3.7 or later


MySQL Version: MySQL 5.7 or later
Tkinter: Python's standard Tkinter library
Other Dependencies: Any other libraries or modules used in the program, if
applicable
BIBILOGRAPHY

1. Python Software Foundation. (2021). Python 3.10.0 documentation.


Python.org. https://docs.python.org/3/

2. MySQL. (2021). MySQL :: MySQL 8.0 Reference Manual. MySQL


Documentation. https://dev.mysql.com/doc/

3. Tkinter. (2021). Tkinter 8.6 documentation. Python.org.


https://docs.python.org/3/library/tkinter.html

4. Subprocess — Subprocess management — Python 3.9.7 documentation.


(n.d.). Python.org. https://docs.python.org/3/library/subprocess.html

You might also like