Skip to content

Commit 1a5bb98

Browse files
committed
Add Student Management System project (Issue #108)
1 parent 5675c6d commit 1a5bb98

File tree

3 files changed

+159
-0
lines changed

3 files changed

+159
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Student Management System
2+
3+
A complete GUI-based Student Management System built with Python.
4+
5+
## Features
6+
- Add new students with automated roll number assignment
7+
- Update student information (address, date of birth)
8+
- Delete student records
9+
- Search by roll number or name
10+
- Secure login interface for administrators only
11+
12+
## Technologies Used
13+
- Python
14+
- Tkinter (GUI)
15+
- Pandas, Numpy (data storage and logic)
16+
17+
## Usage
18+
1. Run `main.py`.
19+
2. Login with username: `admin`, password: `password` (default, can be changed in code).
20+
3. Use the GUI to manage student records.
21+
22+
## Data Storage
23+
Student data is stored in `students.csv` in the same directory.
24+
25+
## Requirements
26+
- Python 3.x
27+
- pandas
28+
- numpy
29+
30+
Install dependencies:
31+
```bash
32+
pip install pandas numpy
33+
```
34+
35+
## Customization
36+
- Change admin credentials in `main.py` (`ADMIN_USER`, `ADMIN_PASS`).
37+
38+
## License
39+
MIT

Student_Management_System/main.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
"""
2+
Student Management System
3+
GUI-based application for managing student records.
4+
Modules: tkinter, pandas, numpy, time
5+
"""
6+
7+
import tkinter as tk
8+
from tkinter import messagebox, simpledialog
9+
import pandas as pd
10+
import numpy as np
11+
import time
12+
import os
13+
14+
DATA_FILE = "students.csv"
15+
ADMIN_USER = "admin"
16+
ADMIN_PASS = "password"
17+
18+
# Initialize data file if not exists
19+
def init_data_file():
20+
if not os.path.exists(DATA_FILE):
21+
df = pd.DataFrame(columns=["Roll", "Name", "Address", "DOB"])
22+
df.to_csv(DATA_FILE, index=False)
23+
24+
# Login Window
25+
def login_window():
26+
login = tk.Tk()
27+
login.title("Admin Login")
28+
login.geometry("300x150")
29+
30+
tk.Label(login, text="Username:").pack()
31+
username_entry = tk.Entry(login)
32+
username_entry.pack()
33+
tk.Label(login, text="Password:").pack()
34+
password_entry = tk.Entry(login, show="*")
35+
password_entry.pack()
36+
37+
def check_login():
38+
user = username_entry.get()
39+
pwd = password_entry.get()
40+
if user == ADMIN_USER and pwd == ADMIN_PASS:
41+
login.destroy()
42+
main_window()
43+
else:
44+
messagebox.showerror("Login Failed", "Invalid credentials!")
45+
46+
tk.Button(login, text="Login", command=check_login).pack(pady=10)
47+
login.mainloop()
48+
49+
# Main Window
50+
def main_window():
51+
root = tk.Tk()
52+
root.title("Student Management System")
53+
root.geometry("400x400")
54+
55+
def add_student():
56+
df = pd.read_csv(DATA_FILE)
57+
name = simpledialog.askstring("Add Student", "Enter Name:")
58+
address = simpledialog.askstring("Add Student", "Enter Address:")
59+
dob = simpledialog.askstring("Add Student", "Enter DOB (YYYY-MM-DD):")
60+
roll = int(df["Roll"].max()) + 1 if not df.empty else 1
61+
df = df.append({"Roll": roll, "Name": name, "Address": address, "DOB": dob}, ignore_index=True)
62+
df.to_csv(DATA_FILE, index=False)
63+
messagebox.showinfo("Success", f"Student added with Roll No: {roll}")
64+
65+
def update_student():
66+
df = pd.read_csv(DATA_FILE)
67+
roll = simpledialog.askinteger("Update Student", "Enter Roll No:")
68+
if roll in df["Roll"].values:
69+
idx = df.index[df["Roll"] == roll][0]
70+
name = simpledialog.askstring("Update Student", "Enter New Name:")
71+
address = simpledialog.askstring("Update Student", "Enter New Address:")
72+
dob = simpledialog.askstring("Update Student", "Enter New DOB (YYYY-MM-DD):")
73+
df.at[idx, "Name"] = name
74+
df.at[idx, "Address"] = address
75+
df.at[idx, "DOB"] = dob
76+
df.to_csv(DATA_FILE, index=False)
77+
messagebox.showinfo("Success", "Student info updated!")
78+
else:
79+
messagebox.showerror("Error", "Roll No not found!")
80+
81+
def delete_student():
82+
df = pd.read_csv(DATA_FILE)
83+
roll = simpledialog.askinteger("Delete Student", "Enter Roll No:")
84+
if roll in df["Roll"].values:
85+
df = df[df["Roll"] != roll]
86+
df.to_csv(DATA_FILE, index=False)
87+
messagebox.showinfo("Success", "Student deleted!")
88+
else:
89+
messagebox.showerror("Error", "Roll No not found!")
90+
91+
def search_student():
92+
df = pd.read_csv(DATA_FILE)
93+
search_by = simpledialog.askstring("Search Student", "Search by 'roll' or 'name':")
94+
if search_by == "roll":
95+
roll = simpledialog.askinteger("Search Student", "Enter Roll No:")
96+
result = df[df["Roll"] == roll]
97+
elif search_by == "name":
98+
name = simpledialog.askstring("Search Student", "Enter Name:")
99+
result = df[df["Name"].str.lower() == name.lower()]
100+
else:
101+
messagebox.showerror("Error", "Invalid search type!")
102+
return
103+
if not result.empty:
104+
info = result.to_string(index=False)
105+
messagebox.showinfo("Student Found", info)
106+
else:
107+
messagebox.showinfo("Not Found", "No student found!")
108+
109+
tk.Button(root, text="Add Student", command=add_student, width=25).pack(pady=10)
110+
tk.Button(root, text="Update Student", command=update_student, width=25).pack(pady=10)
111+
tk.Button(root, text="Delete Student", command=delete_student, width=25).pack(pady=10)
112+
tk.Button(root, text="Search Student", command=search_student, width=25).pack(pady=10)
113+
tk.Button(root, text="Exit", command=root.destroy, width=25).pack(pady=10)
114+
root.mainloop()
115+
116+
if __name__ == "__main__":
117+
init_data_file()
118+
login_window()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pandas
2+
numpy

0 commit comments

Comments
 (0)