0% found this document useful (0 votes)
12 views

cs project file (1)

Uploaded by

schoolbbanner
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

cs project file (1)

Uploaded by

schoolbbanner
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

S.B.I.O.A.

INTERNATIONALSCHOOL

Polachery Main Road, Sonalur,


Chennai-600127
PROJECTREPORT
2024–2025

Name: A. Nishanth Dev

Class: XII Sec: A

Reg.No:

Title of the Project: Email collection List


BONAFIDE CERTIFICATE
ACKNOWLEDGMENT
FITTNESS
TRACKER

COMPUTER SCIENCE PROJECT


INDEX
TITLE:
 Objective
 Module and file used
 Scope
 Technology requirements
 Source code
 Output screen
 Conclusion
OBJECTIVES
Create a Functional GUI:

 Develop a user-friendly graphical user interface (GUI) using Tkinter for the fitness
tracker application. Establish Database Connectivity:

 Implement MySQL as the backend database to store fitness activities.


 Ensure secure and efficient database connectivity using mysql.connector.

Data Entry and Management:

 Enable users to add new fitness activities with details such as activity type, time spent,
distance covered, and calories burned.
 Provide functionality to update existing activities with new information.
 Allow users to delete activities from the database.

Input Validation:

 Implement input validation to ensure all necessary fields are filled before submitting
the data.
 Provide user feedback for missing or incorrect input to prevent errors.

Database Operations:

 Execute SQL queries to perform CRUD (Create, Read, Update, Delete) operations on
the fitness tracker database.
 Ensure data integrity and prevent SQL injection attacks.

Error Handling:

 Implement error handling to manage database connectivity issues and invalid


operations gracefully.
 Provide informative error messages to guide the user in resolving issues.

User Interaction:

 Design intuitive buttons and input fields to make the application easy to navigate.
 Ensure that all interactions with the database provide immediate feedback to the user.

Data Persistence:

 Ensure that all data entered by users is reliably stored in the MySQL database.
 Allow retrieval and modification of data as needed for updates and deletions.
Application Modularity:

 Structure the code to maintain a clear separation between the GUI and database
logic.
 Promote code readability and ease of maintenance through well-defined functions
and comments.

Scalability and Future Enhancements:

 Design the application with scalability in mind to allow for future enhancements, such
as additional fitness metrics or advanced data analysis features.
 Keep the code modular to facilitate the integration of new features without major
overhauls.
MODULUES AND FILES USED
Modules

1. tkinter
o Used for creating the graphical user interface (GUI).
2. mysql.connector
o Used for connecting to the MySQL database and executing
SQL queries.
3. tkinter.messagebox
o Used for displaying message boxes to the user for alerts
and confirmations.
4. tkinter.simpledialog
o Used for prompting the user to enter data through simple
dialog boxes.

Files

1. main.py
o This will be the main file that initializes the GUI, handles
user interactions, and integrates all components.
2. db_connection.py
o Contains the logic for establishing a connection with the
MySQL database.
o Handles basic CRUD operations and database interactions.
3. gui.py
o Contains the code for the GUI layout and design using
Tkinter.
o Includes functions for creating and arranging widgets.
4. config.py
o Contains configuration details such as database connection
parameters (host, user, password, database name).
SCOPE
User Interface Development:

 Design a user-friendly GUI using Tkinter to enable users to interact with


the application.
 Provide input fields for activity type, time spent, distance covered, and
calories burned.
 Include buttons for adding, deleting, and updating activities.

Database Integration:

 Utilize MySQL as the backend database for storing fitness activity data.
 Establish secure and reliable database connectivity using mysql.connector.
 Create necessary database schemas and tables to store activity
information.

Core Functionalities:

 Implement the functionality to add new fitness activities to the database.


 Provide options to delete existing activities based on their unique
identifiers.
 Enable updating of existing activity records with new data.

Input Validation:

 Ensure all fields are filled before submitting data to the database.
 Implement validation checks to prevent invalid data entries.
 Provide user feedback for missing or incorrect inputs.Error Handling:

 Handle database connectivity issues gracefully.


 Provide clear and informative error messages to users for various failure
scenarios.Data Integrity and Security:

 Ensure data integrity during add, delete, and update operations.


 Implement measures to prevent SQL injection and other common security
vulnerabilities.

User Feedback:

 Provide immediate feedback to the user upon successful completion of


database operations.
 Display appropriate messages for successful addition, deletion, and
updating of activities.
Code Modularity:

 Maintain a clear separation of concerns by dividing the project into


multiple modules (files).
 Ensure the code is organized, readable, and maintainable.

Configuration Management:

 Store database connection parameters in a separate configuration file


(config.py).
 Allow easy modification of database connection settings without altering
the main codebase.

Extensibility:

 Design the application with future enhancements in mind.


 Ensure the code structure allows for easy addition of new features, such
as data analysis, reporting, or integration with other fitness tracking
services.

TECHNOLOGY REQUIREMENTS

HARDWARE:

• PROCESSOR: Dual-core processor


• RAM: 4GBofram
• STORAGE: 100MBofstorage
• MONITOR: 15”ColorMonitor
• KEYBOARD
• MOUSE

SOFTWARE:

• OPERATINGSYSTEM:
Windows7orAbove
• ENVIRONMEN: Visual Studios
• LANGUAGE: Python and SQL
• FRONTEND: Pythonversion3.10
• BACKEND: SQL Workbench
SOURCE CODE

CREATE DATABASE fitness_tracker;

CREATE DATABASE IF NOT EXISTS fitness_tracker;

USE fitness_tracker;

DROP TABLE IF EXISTS activities;

CREATE TABLE activities (

id INT AUTO_INCREMENT PRIMARY KEY,

activity_type VARCHAR(255) NOT NULL,

distance FLOAT NOT NULL,

calories_burned FLOAT NOT NULL

);

import tkinter as tk
from tkinter import messagebox, ttk
import mysql.connector

# Database connection
conn = mysql.connector.connect(
host="localhost",
user="your_username",
password="your_password",
database="fitness_tracker"
)
cursor = conn.cursor()

# GUI setup
root = tk.Tk()
root.title("Fitness Tracker")

# Labels and Entry widgets


tk.Label(root, text="Activity Type:").grid(row=0, column=0)
activity_type_entry = tk.Entry(root)
activity_type_entry.grid(row=0, column=1)

tk.Label(root, text="Distance (km):").grid(row=1, column=0)


distance_entry = tk.Entry(root)
distance_entry.grid(row=1, column=1)

tk.Label(root, text="Calories Burned:").grid(row=2, column=0)


calories_entry = tk.Entry(root)
calories_entry.grid(row=2, column=1)

# Treeview for displaying activities


columns = ("id", "activity_type", "distance", "calories_burned")
tree = ttk.Treeview(root, columns=columns, show='headings')
for col in columns:
tree.heading(col, text=col.replace("_", " ").title())
tree.grid(row=4, column=0, columnspan=4)

def refresh_treeview():
for row in tree.get_children():
tree.delete(row)
cursor.execute("SELECT * FROM activities")
for row in cursor.fetchall():
tree.insert("", "end", values=row)

# Functions to interact with database


def add_activity():
activity_type = activity_type_entry.get()
distance = distance_entry.get()
calories = calories_entry.get()

if not (activity_type and distance and calories):


messagebox.showwarning("Input Error", "Please fill all fields")
return

query = "INSERT INTO activities (activity_type, distance,


calories_burned) VALUES (%s, %s, %s)"
values = (activity_type, distance, calories)
cursor.execute(query, values)
conn.commit()
messagebox.showinfo("Success", "Activity added successfully")
refresh_treeview()

def delete_activity():
selected_item = tree.selection()
if not selected_item:
messagebox.showwarning("Selection Error", "Please select an
activity to delete")
return
item = tree.item(selected_item)
activity_id = item['values'][0]
query = "DELETE FROM activities WHERE id = %s"
cursor.execute(query, (activity_id,))
conn.commit()
messagebox.showinfo("Success", "Activity deleted successfully")
refresh_treeview()

# Buttons
tk.Button(root, text="Add Activity", command=add_activity).grid(row=3,
column=0)
tk.Button(root, text="Delete Activity",
command=delete_activity).grid(row=3, column=1)

# Initial data load


refresh_treeview()

# Run the GUI loop


root.mainloop()

# Close database connection when done


conn.close()
OUTPUT

GUI TABLE CREATED WITH 3 TYPES OF ROWS WITH DATA ADDED TO


THE REQUIRED BOX .
- Activity type
- Distance (km)
- Calories burned
ADDING ACTIVITY TO THE DATABASE IN GUI

SELECTING ACTIVITY TO BE DELETED


SUCCESSFULLY DELETED THE ACTIVITY
CONCLUSION:

The fitness tracker project successfully demonstrates the


integration of Python with Tkinter for GUI development and
MySQL for backend database management. Through this
project, we achieved the following:

1. User-Friendly Interface:
o Designed a straightforward and intuitive GUI that
allows users to easily enter, update, and delete
fitness activity data.
2. Efficient Database Management:
o Utilized MySQL to store, retrieve, and manage
fitness data, ensuring reliable data persistence
and integrity.
3. Comprehensive Functionality:
o Implemented core functionalities including adding
new activities, updating existing records, and
deleting activities, all while providing real-time
feedback to the user.
4. Input Validation and Error Handling:
o Ensured robust input validation to prevent
incorrect data entries and implemented error
handling mechanisms to manage potential issues
gracefully.
5. Modular and Maintainable Code:
o Organized the project into distinct modules,
promoting code readability, maintainability, and
ease of future enhancements.
6. Scalability and Extensibility:
Designed the application with scalability in mind,
o
laying a strong foundation for future feature
additions and improvements.
7. Secure Data Operations:
o Implemented measures to ensure secure data
operations, protecting the application from
common vulnerabilities like SQL injection.

By achieving these objectives, the fitness tracker project


provides a solid, functional application that not only meets
the initial requirements but is also well-prepared for future
growth. This project serves as a valuable example of
combining different technologies to create a cohesive and
practical software solution, demonstrating effective
techniques in GUI design, database management, and
software development best practices

BIBILIOGRAPHY:

( Resources used to create this project )

www.w3school.com

www.youtube.com/techwithtim

www.openai.com

www.blackboxai.com

www.youtube,com/amitthinks

www.greeksforgreeks.org

You might also like