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

School Management

The document is a project report by Tushar Singh for a School Management System, prepared under the guidance of Mrs. Upasna. It includes acknowledgments, requirements for hardware and software, and a detailed description of the system's functionalities using Python and MySQL. The project aims to manage student data efficiently through a user-friendly interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

School Management

The document is a project report by Tushar Singh for a School Management System, prepared under the guidance of Mrs. Upasna. It includes acknowledgments, requirements for hardware and software, and a detailed description of the system's functionalities using Python and MySQL. The project aims to manage student data efficiently through a user-friendly interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 34

SHRI BABA

MASTNATH SR SEC
PUBLIC SCHOOL
Submitted By:-
Tushar Singh
Class : 12th Green
Board Roll no. : 123456789009999999

Under the Guidance of:


Mrs. Upasna Mam

ACKNOWLED
GEMENT

This is to certify that Tushar Singh of


Class 12th has prepared the report on the
project entitled School Management
System. The report is the result of his
efforts and endeavors. The report is found
worthy of acceptance as final project report
for the subject Computer Science. He
has prepared the prohect under the guidance
of the subject teacher Mrs. Upasna.

(Mrs. Upasna)

Certificate
The project report entitled

School Management System


Submitted by Tushar Singh of Class 12th for the
C.B.S.E. Senior Secondary Examination of
computer science under the guidance of the
subject teacher, Mrs. Upasna is found to be
correct under all means.
Requirement
Specification
s
Hardware Requirements:-
RAM:- 4 Gb
Hard Disk:- 500 Gb
Processor:- Intel Core i3
Software Requirements:-
Operating System:- Windows 10
Front Design:- Python IDLE 3.6
Front-End Language:- VB.NET
Back-End Language:- MySQL

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

# Initializing window frame


window = tk.Tk()
window.geometry("1350x700")
window.title("Student Management")

Label_Heading = tk.Label(window, text="Student


Management System", font=("Times new roman",
35, "bold"), bg="blue", fg="yellow", border=12,
relief=tk.GROOVE)
Label_Heading.pack(side=tk.TOP, fill=tk.X)

Frame_Details = tk.LabelFrame(window,
text="Enter details", font=("Times new roman", 22,
"bold"), bd=12, relief=tk.GROOVE, bg="#e3f4f1")
Frame_Details.place(x=20, y=100, width=400,
height=575)
Frame_Data = tk.Frame(window, bd=12,
relief=tk.GROOVE, bg="#e3f4f1")
Frame_Data.place(x=440, y=100, width=890,
height=575)

# Variables
rollno = tk.StringVar()
name = tk.StringVar()
email = tk.StringVar()
gender = tk.StringVar()
class_var = tk.StringVar()
contact = tk.StringVar()
dob = tk.StringVar()
address = tk.StringVar()
search_box = tk.StringVar()
search_value = tk.StringVar() # For search value
input

# Entry widget
Label_Name = tk.Label(Frame_Details,
text="Name", font=("Times new roman", 17),
bg="#e3f4f1")
Label_Name.grid(row=0, column=0, padx=2,
pady=2)
Entry_Name = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=name)
Entry_Name.grid(row=0, column=1, padx=2,
pady=2)

Label_RollNo = tk.Label(Frame_Details, text="Roll


No", font=("Times new roman", 17), bg="#e3f4f1")
Label_RollNo.grid(row=1, column=0, padx=2,
pady=2)
Entry_RollNo = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=rollno)
Entry_RollNo.grid(row=1, column=1, padx=2,
pady=2)

Label_Email = tk.Label(Frame_Details,
text="Email", font=("Times new roman", 17),
bg="#e3f4f1")
Label_Email.grid(row=2, column=0, padx=2,
pady=2)
Entry_Email = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=email)
Entry_Email.grid(row=2, column=1, padx=2,
pady=2)

Label_Gender = tk.Label(Frame_Details,
text="Gender", font=("Times new roman", 17),
bg="#e3f4f1")
Label_Gender.grid(row=3, column=0, padx=2,
pady=2)
Entry_Gender = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=gender)
Entry_Gender.grid(row=3, column=1, padx=2,
pady=2)
Label_Class = tk.Label(Frame_Details,
text="Class", font=("Times new roman", 17),
bg="#e3f4f1")
Label_Class.grid(row=4, column=0, padx=2,
pady=2)
Entry_Class = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=class_var)
Entry_Class.grid(row=4, column=1, padx=2,
pady=2)

Label_contact_No = tk.Label(Frame_Details,
text="Contact No", font=("Times new roman", 17),
bg="#e3f4f1")
Label_contact_No.grid(row=6, column=0, padx=2,
pady=2)
Entry_contact_No = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=contact)
Entry_contact_No.grid(row=6, column=1, padx=2,
pady=2)

Label_DOB = tk.Label(Frame_Details, text="D.O.B",


font=("Times new roman", 17), bg="#e3f4f1")
Label_DOB.grid(row=7, column=0, padx=2,
pady=2)
Entry_DOB = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=dob)
Entry_DOB.grid(row=7, column=1, padx=2,
pady=2)

Label_Address = tk.Label(Frame_Details,
text="Address", font=("Times new roman", 17),
bg="#e3f4f1")
Label_Address.grid(row=8, column=0, padx=2,
pady=2)
Entry_Address = tk.Entry(Frame_Details, bd=7,
font=("Times new roman", 17), width=17,
textvariable=address)
Entry_Address.grid(row=8, column=1, padx=2,
pady=2)

# Function to create a database connection


def create_connection():
return my.connect(host='localhost',
user='TusharSingh', passwd='123456',
database='stud_ms')
# Function to get data
def GET_DATA():
con = create_connection()
cur = con.cursor()
cur.execute('SELECT * FROM data')
rows = cur.fetchall()
con.close()

if len(rows) != 0:

Student_table.delete(*Student_table.get_children()
)
for row in rows:
Student_table.insert('', tk.END, values=row)

# Function to add data


def ADD_DATA():
if rollno.get() == "" or name.get() == "" or
class_var.get() == "":
messagebox.showerror('Error', 'All Fields
required')
else:
con = create_connection()
cur = con.cursor()
query = "INSERT INTO data (name, rollno,
email, gender, class_var, contact, dob, address)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)"
cur.execute(query, (name.get(), rollno.get(),
email.get(), gender.get(), class_var.get(),
contact.get(), dob.get(), address.get()))
con.commit()
con.close()
GET_DATA()
CLEAR()
messagebox.showinfo("Record has been
saved successfully")

# Function to update data


def UPDATE_DATA():
# Check if the rollno field is empty
if rollno.get() == "":
messagebox.showerror('Error', 'Roll No is
required to update the record')
return

# Check if the name field is empty


if name.get() == "":
messagebox.showerror('Error', 'Name is
required to update the record')
return

try:
# Create a connection to the database
con = create_connection()
cur = con.cursor()

# SQL query to update the record


query = """UPDATE data
SET name=%s, email=%s, gender=%s,
class_var=%s, contact=%s, dob=%s, address=%s
WHERE rollno=%s"""

# Execute the query with the updated values


cur.execute(query, (name.get(), email.get(),
gender.get(), class_var.get(), contact.get(),
dob.get(), address.get(), rollno.get()))

# Commit the changes to the database


con.commit()

# Close the connection


con.close()

# Refresh the table with updated data


GET_DATA()

# Clear all entry fields after update


CLEAR()

# Provide a success message


messagebox.showinfo("Success", "Record
updated successfully")

except Exception as e:
# Handle any errors during the update
process
messagebox.showerror('Error', f"An error
occurred: {e}")

# Function to search data


def SEARCH_DATA():
search_by = search_box.get()
value = search_value.get()

if not value:
messagebox.showwarning("Input Required",
"Please enter a search term.")
return

query = f"SELECT * FROM data WHERE


{search_by} LIKE '%{value}%'"

con = create_connection()
cur = con.cursor()
cur.execute(query)
rows = cur.fetchall()
con.close()

if len(rows) != 0:

Student_table.delete(*Student_table.get_children()
)
for row in rows:
Student_table.insert('', tk.END, values=row)

# Clear all entry fields


def CLEAR():
name.set("")
rollno.set("")
email.set("")
gender.set("")
class_var.set("")
contact.set("")
dob.set("")
address.set("")
search_value.set("") # Clear the search term too
def DELETE():
# Check if the rollno field is empty
if rollno.get() == "":
messagebox.showerror('Error', 'Please enter
the Roll No to delete')
return

# Confirm deletion with the user


confirmation = messagebox.askyesno("Confirm
Deletion", f"Are you sure you want to delete the
record with Roll No: {rollno.get()}?")

if confirmation:
try:
# Create a connection to the database
con = create_connection()
cur = con.cursor()

# SQL query to delete the record


query = 'DELETE FROM data WHERE rollno=
%s'
cur.execute(query, (rollno.get(),))
# Commit the transaction
con.commit() # Ensure commit after
deletion
con.close()

# Update the data in the table and clear the


fields
GET_DATA() # Refresh table to show the
updated data (after deletion)
Student_table.update_idletasks() # Force
the table to refresh
CLEAR()
messagebox.showinfo('Success', 'Record
has been deleted successfully')

except Exception as e:
# Handle any errors that might occur
messagebox.showerror('Error', f"An error
occurred: {e}")

# Function to populate the entry fields with data


from the table row
def FOCUS(e):
cursor = Student_table.focus() # Get the
selected row

# Check if a row is actually selected


if not cursor:
messagebox.showwarning("No Selection",
"Please select a row first")
return

content = Student_table.item(cursor) # Get the


data from the row
row = content.get('values', []) # The row data
(get it safely)

# Check if the row contains the correct number


of columns
if len(row) == 0:
messagebox.showwarning("Empty Row",
"Selected row is empty")
return
# Populate the fields with data from the clicked
row
name.set(row[0]) # Name
rollno.set(row[1]) # Roll No
email.set(row[2]) # Email
gender.set(row[3]) # Gender
class_var.set(row[4]) # Class
contact.set(row[5]) # Contact No
dob.set(row[6]) # D.O.B
address.set(row[7]) # Address

# Buttons
Frame_Btn = tk.Frame(Frame_Details,
bg="#e3f4f1", bd=7, relief=tk.GROOVE)
Frame_Btn.place(x=15, y=390, width=348,
height=120)

Add_Button = tk.Button(Frame_Btn, bg="#e3f4f1",


text="Add", bd=7, font=("Times new roman", 15),
width=13, command=ADD_DATA)
Add_Button.grid(row=0, column=0, padx=2,
pady=2)
Delete_Button = tk.Button(Frame_Btn,
bg="#e3f4f1", text="Delete", bd=7, font=("Times
new roman", 15), width=13, command=DELETE)
Delete_Button.grid(row=0, column=1, padx=2,
pady=2)

Update_Button = tk.Button(Frame_Btn,
bg="#e3f4f1", text="Update", bd=7, font=("Times
new roman", 15), width=13,
command=UPDATE_DATA)
Update_Button.grid(row=1, column=0, padx=2,
pady=2)

Clear_Button = tk.Button(Frame_Btn,
bg="#e3f4f1", text="Clear", bd=7, font=("Times
new roman", 15), width=13, command=CLEAR)
Clear_Button.grid(row=1, column=1, padx=2,
pady=2)

# Search Frame
Frame_Search = tk.Frame(Frame_Data,
bg="#e3f4f1", bd=10, relief=tk.GROOVE)
Frame_Search.pack(side=tk.TOP, fill=tk.X)
Label_Search = tk.Label(Frame_Search,
text="Search", bg="#e3f4f1", font=("Times new
roman", 16))
Label_Search.grid(row=0, column=0, padx=12,
pady=2)

Search_Box = ttk.Combobox(Frame_Search,
font=("Times new roman", 16), state="readonly",
textvariable=search_box)
Search_Box['values'] = ("name", "rollno", "email",
"class_var", "contact", "dob")
Search_Box.grid(row=0, column=1, padx=12,
pady=2)

Entry_Search = tk.Entry(Frame_Search,
font=("Times new roman", 16),
textvariable=search_value)
Entry_Search.grid(row=0, column=2, padx=12,
pady=2)

Search_Button = tk.Button(Frame_Search,
bg="#e3f4f1", text="Search", bd=7, font=("Times
new roman", 15), width=14,
command=SEARCH_DATA)
Search_Button.grid(row=0, column=3, padx=12,
pady=2)

# Database Frame
Frame_Database = tk.Frame(Frame_Data,
bg="#e3f4f1", bd=11, relief=tk.GROOVE)
Frame_Database.pack(fill=tk.BOTH, expand=True)

Scroll_X = tk.Scrollbar(Frame_Database,
orient=tk.HORIZONTAL)
Scroll_Y = tk.Scrollbar(Frame_Database,
orient=tk.VERTICAL)

Student_table = ttk.Treeview(Frame_Database,
columns=("Name", "Roll No", "Email", "Gender",
"Class", "Contact No", "D.O.B", "Address"),
yscrollcommand=Scroll_Y.set,
xscrollcommand=Scroll_X.set)

Scroll_X.config(command=Student_table.xview)
Scroll_X.pack(side=tk.BOTTOM, fill=tk.X)
Scroll_Y.config(command=Student_table.yview)
Scroll_Y.pack(side=tk.RIGHT, fill=tk.Y)
Student_table.heading("Name", text="Name")
Student_table.heading("Roll No", text="Roll No")
Student_table.heading("Email", text="Email")
Student_table.heading("Gender", text="Gender")
Student_table.heading("Class", text="Class")
Student_table.heading("Contact No",
text="Contact No")
Student_table.heading("D.O.B", text="D.O.B")
Student_table.heading("Address", text="Address")

Student_table['show'] = 'headings'
Student_table.column("Name", width=100)
Student_table.column("Roll No", width=100)
Student_table.column("Email", width=100)
Student_table.column("Gender", width=100)
Student_table.column("Class", width=100)
Student_table.column("Contact No", width=100)
Student_table.column("D.O.B", width=100)
Student_table.column("Address", width=150)
Student_table.pack(fill=tk.BOTH, expand=True)
GET_DATA() # Populate data on startup
Student_table.bind("<ButtonRelease-1>", FOCUS)

window.mainloop()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy