IP Ip
IP Ip
IP Ip
2024-2025
1|Page
ACKNOWLEDGMENT
It is with pleasure that I find myself penning down these lines to express
COIMBATORE
DATE :
2|Page
INDEX
1 Overview Of Python 4
4 Need For 9
Computerisation
5 Source Code 10
6 Output 19
7 Bibliography 22
OVERVIEW OF PYTHON
3|Page
Python is a high-level, interpreted, interactive, and object-oriented
scripting language, known for its readability. It frequently uses English
keywords, unlike many other languages that use punctuation, and has
fewer syntactical constructions.
Python Features:
Easy to Learn: With few keywords, a simple structure, and clear syntax,
Python is easy to pick up.
4|Page
Broad Standard Library: Python's extensive library is portable and cross-
platform compatible across UNIX, Windows, and Macintosh.
Scalable: Python offers better structure and support for large programs
compared to shell scripting.
Additional Features:
Supports functional and structured programming methods as well
as object-oriented programming.
5|Page
HARDWARE & SOFTWARE
REQUIREMENTS
Hardware Requirements:
Disk Space: At least 1 GB of free disk space for the Python environment and
project files.
Software Requirements:
Operating Systems:
Windows 7 or later
macOS 10.12 (Sierra) or later Linux (any modern distribution)
Python Versions:
Python 2.7.X
Python 3.6.X or later (recommended)
6|Page
Included Development Tools:
8|Page
NEED FOR COMPUTERISATION
The need for computerization of sports management software arises from the
increasing complexity and scale of modern sports organizations, tournaments, and
athlete management. Here are some key reasons why computerization is essential:
SOURCE CODE
9|Page
MYSQL:
Create database sports_db;
Python:
import tkinter as tk
from tkinter import ttk, messagebox
import mysql.connector
from datetime import datetime
app = tk.Tk()
app.title("Sports Management Software")
app.attributes('-fullscreen', True)
# Font settings
font_settings = ("Arial", 16)
# Back Button
back_button = tk.Button(left_pane, text="Back", command=lambda: back_to_main(), font=font_settings)
back_button.pack(pady=10)
# Exit Button
exit_button = tk.Button(left_pane, text="Exit", command=app.destroy, font=font_settings)
exit_button.pack(pady=10)
10 | P a g e
# Main frame for the initial page
main_frame = tk.Frame(app)
main_frame.pack(expand=True)
# Error label
error_label = tk.Label(main_frame, text="", font=font_settings, fg="red")
error_label.grid(row=8, column=0, columnspan=2, pady=10)
# Database setup
def setup_database():
try:
conn = mysql.connector.connect(
host='localhost',
user='root',
password='123456',
database='sports_db'
)
cursor = conn.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS athletes (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
athlete_class VARCHAR(255),
dob DATE,
admission_no VARCHAR(255),
gender VARCHAR(10),
category VARCHAR(50),
events TEXT
)''')
conn.commit()
except mysql.connector.Error as err:
show_error(str(err))
finally:
if conn.is_connected():
cursor.close()
conn.close()
11 | P a g e
def clear_category_selection():
for widget in app.winfo_children():
if isinstance(widget, tk.Frame) and widget != left_pane and widget != main_frame:
widget.destroy()
12 | P a g e
name = name_entry.get()
athlete_class = class_entry.get()
dob = dob_entry.get()
admission_no = admission_entry.get()
gender = gender_var.get()
category = category_combobox.get()
calculated_category = determine_category(dob)
if calculated_category is None:
return
if not selected_events:
show_error("Please select at least 1 event.")
return
# Enforce the 2 Track and 1 Field or 1 Track and 2 Field constraint (for maximum limit)
13 | P a g e
if not ((track_count <= 2 and field_count <= 2) and (track_count + field_count <= 3)):
show_error("You must select either 2 Track and 1 Field or 2 Field and 1 Track, with a maximum of 3 events.")
return
if relay_selected:
selected_events.append("relay") # Add relay back to the list of selected events
try:
conn = mysql.connector.connect(
host='localhost',
user='root',
password='123456',
database='sports_db'
)
cursor = conn.cursor()
cursor.execute('INSERT INTO athletes (name, athlete_class, dob, admission_no, gender, category, events) VALUES (%s,
%s, %s, %s, %s, %s, %s)',
(name, athlete_class, dob, admission_no, gender, category, events_string))
conn.commit()
reset_fields()
# Function to reset the input fields and clear the error message
def reset_fields():
name_entry.delete(0, tk.END)
class_entry.delete(0, tk.END)
dob_entry.delete(0, tk.END)
admission_entry.delete(0, tk.END)
gender_var.set(None)
category_combobox.set('Select Category')
event_listbox.delete(0, tk.END)
clear_error() # Clears the error message when fields are reset
14 | P a g e
# Function to display error or success messages in the window
def show_error(message, is_error=True):
error_label.config(text=message, fg="red" if is_error else "green")
# Category Combobox
category_combobox = ttk.Combobox(category_frame, values=['Under 12', 'Under 14', 'Under 17', 'Under 19'], state="readonly")
category_combobox.pack(pady=10)
15 | P a g e
confirm_button.pack(pady=10)
participants = [row[0] for row in rows] # Extract names from the fetched rows
return participants
except mysql.connector.Error as err:
show_error(str(err))
return []
finally:
if conn.is_connected():
16 | P a g e
cursor.close()
conn.close()
# Athlete Name
tk.Label(main_frame, text="Name:").grid(row=1, column=0, padx=10, pady=10)
name_entry = tk.Entry(main_frame)
name_entry.grid(row=1, column=1)
# Athlete Class
tk.Label(main_frame, text="Class:").grid(row=2, column=0, padx=10, pady=10)
class_entry = tk.Entry(main_frame)
class_entry.grid(row=2, column=1)
# DOB
tk.Label(main_frame, text="DOB (YYYY-MM-DD):").grid(row=3, column=0, padx=10, pady=10)
17 | P a g e
dob_entry = tk.Entry(main_frame)
dob_entry.grid(row=3, column=1)
# Admission No
tk.Label(main_frame, text="Admission No:").grid(row=4, column=0, padx=10, pady=10)
admission_entry = tk.Entry(main_frame)
admission_entry.grid(row=4, column=1)
# Gender Selection
tk.Label(main_frame, text="Gender:").grid(row=5, column=0, padx=10, pady=10)
gender_var = tk.StringVar()
male_radio = tk.Radiobutton(main_frame, text="Male", variable=gender_var, value="Male", command=populate_events)
male_radio.grid(row=5, column=1, sticky=tk.W)
female_radio = tk.Radiobutton(main_frame, text="Female", variable=gender_var, value="Female", command=populate_events)
female_radio.grid(row=5, column=1)
# Category Selection
tk.Label(main_frame, text="Category:").grid(row=6, column=0, padx=10, pady=10)
category_combobox = ttk.Combobox(main_frame, values=['Under 12', 'Under 14', 'Under 17', 'Under 19'], state="readonly")
category_combobox.grid(row=6, column=1)
# Event Listbox
tk.Label(main_frame, text="Select Events:").grid(row=7, column=0, padx=10, pady=10)
event_listbox = tk.Listbox(main_frame, selectmode=tk.MULTIPLE)
event_listbox.grid(row=7, column=1)
# Save Button
save_button = tk.Button(main_frame, text="Save Athlete", command=save_athlete)
save_button.grid(row=8, column=0, columnspan=2, pady=10)
18 | P a g e
OUTPUT
19 | P a g e
Second page UI:
For viewing the event wise student list
Category selection for event wise student list
20 | P a g e
Student list is displayed according to the event selected by athletes
MYSQL table :
MYSQL table where the details of athletes are stored
21 | P a g e
Bibliography
https://www.geeksforgeeks.org/
https://www.google.com/
22 | P a g e