CS Project File.docx

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

JAWAHAR NAVODAYA VIDYALAYA

AHMEDABAD

Submitted As
COMPUTER SCIENCE PROJECT
CLASS XII, 2023 - 24

Created By :-
Vipul Bhatiya
Vishal Bhatiya
Sandip Nakum
Dhruv Raval
Acknowledgement

We would like to express our special thanks to our


teacher Tarun Baria as well as our principal
Ravindra Kumar Dixit who gave us the golden
opportunity to do this wonderful project titled
STUDENT RESULT MANAGEMENT SYSTEM ,
which also helped us in doing a lot of Research and
we came to know about so many new things. We
are really thankful to them.Secondly we would also
like to thank our parents and friends who helped me
a lot in finalizing this project within the limited time
frame.
Certificate

This is to certify that Vipul Bhatiya , Vishal


Bhatiya , Sandip Nakum and Dhruv Raval of
class XII from JNV Ahmedabad who were
allowed to do work on this project titled Student
Result Management System have faithfully
carried out this project under my guidance and
supervision and the accompanying report is
completely their genuine work. They have
completed the necessary preliminaries and have
submitted the Project in allotted time.

Teacher Sign. Principal Sign.


INTRODUCTION
This project is about result management of students and their unique courses.
Here,we define different classes for different work.
We define different 5 classes with respective works,just like follows:
CONTENTS OF THE PROJECT
1) Schools will enter details of students with respective courses and students also add
their details.
2)add student’s details if any new students are arrived.
3) show results of students with respective courses with full details
4) show the courses available and student who takes
5) show available different courses for more successiveness for school
And at last this has an unique interface to check and show these above details.

There are four files in the project.Read.py file displays the products available in the store
.Write.py file update the no. of products when a purchase is made, also asks the customer
if he or she is willing to buy more.Purchase.py file generate the invoice for the customer
with unique naming.Main.py file sums up all the files in order to do the billing work
properly.
SOURCE CODE

File1:register.py
from tkinter import*
from tkinter import ttk,messagebox
from PIL import Image,ImageTk #pip install pillow
# import pymysql
import sqlite3
class Register:
def __init__(self,root):
self.root=root
self.root.title("Registration Window")
self.root.geometry("1350x700+0+0")
self.root.config(bg="white")
#===BG Image=====
self.bg=ImageTk.PhotoImage(file="image//b2.jpg")
bg=Label(self.root,image=self.bg).
place(x=250,y=0,relwidth=1,relheight=1)

#===LEFT Image=====
self.left=ImageTk.PhotoImage(file="image//side.png")
left=Label(self.root,image=self.left).
place(x=80,y=100,width=400,height=500)

#===Register Frame=====
frame1=Frame(self.root,bg="white")
frame1.place(x=480,y=100,width=700,height=500)
title=Label(frame1,text="REGISTER HERE",font=("times new
roman",20,"bold"),bg="white",fg="green").place(x=50,y=30)

#------------------------------------Row1
f_name=Label(frame1,text="FIRST NAME",font=("times new
roman",15,"bold"),bg="white",fg="gray").place(x=50,y=100)
self.txt_fname=Entry(frame1,font=("times new roman",15),bg="lightgray")
self.txt_fname.place(x=50,y=130,width=250)

l_name=Label(frame1,text="LAST NAME",font=("times new


roman",15,"bold"),bg="white",fg="gray").place(x=370,y=100)
self.txt_lname=Entry(frame1,font=("times new roman",15),bg="lightgray")
self.txt_lname.place(x=370,y=130,width=250)
#------------------------------------Row2
contact=Label(frame1,text="Contact No.",font=("times new
roman",15,"bold"),bg="white",fg="gray").place(x=50,y=170)
self.txt_contact=Entry(frame1,font=("times new
roman",15),bg="lightgray")
self.txt_contact.place(x=50,y=200,width=250)

email=Label(frame1,text="Email",font=("times new
roman",15,"bold"),bg="white",fg="gray").place(x=370,y=170)
self.txt_email=Entry(frame1,font=("times new roman",15),bg="lightgray")
self.txt_email.place(x=370,y=200,width=250)

#------------------------------------Row3
question=Label(frame1,text="Security Question",font=("times new
roman",15,"bold"),bg="white",fg="gray").place(x=50,y=240)
self.cmb_quest=ttk.Combobox(frame1,font=("times new
roman",13),state='readonly',justify=CENTER)
self.cmb_quest['values']=("Select","Your First Pet Name","Your Birth
Place","Your Best Friend Name")
self.cmb_quest.place(x=50,y=270,width=250)
self.cmb_quest.current(0)

answer=Label(frame1,text="Answer",font=("times new
roman",15,"bold"),bg="white",fg="gray").place(x=370,y=240)
self.txt_answer=Entry(frame1,font=("times new roman",15),bg="lightgray")
self.txt_answer.place(x=370,y=270,width=250)

#------------------------------------Row4
password=Label(frame1,text="Password",font=("times new
roman",15,"bold"),bg="white",fg="gray").place(x=50,y=310)
self.txt_password=Entry(frame1,font=("times new
roman",15),bg="lightgray")
self.txt_password.place(x=50,y=340,width=250)

cpassword=Label(frame1,text="Confirm Password",font=("times new


roman",15,"bold"),bg="white",fg="gray").place(x=370,y=310)
self.txt_cpassword=Entry(frame1,font=("times new
roman",15),bg="lightgray")
self.txt_cpassword.place(x=370,y=340,width=250)

#----------------------------------Terms
self.var_chk=IntVar()
chk=Checkbutton(frame1,text="I Agree The Terms &
Conditions",variable=self.var_chk,onvalue=1,offvalue=0,bg="white",font=(
"times new roman",12)).place(x=50,y=380)
self.btn_img=ImageTk.PhotoImage(file="image//register.png")
btn_register=Button(frame1,image=self.btn_img,bd=0,cursor="hand2",comman
d=self.register_data).place(x=50,y=420)

btn_login=Button(self.root,text="Sign
In",command=self.login_window,font=("times new
roman",20),bd=0,cursor="hand2").place(x=200,y=460,width=180)

def login_window(self):
self.root.destroy()
import login

def clear(self):
self.txt_fname.delete(0,END)
self.txt_lname.delete(0,END)
self.txt_contact.delete(0,END)
self.txt_email.delete(0,END)
self.txt_answer.delete(0,END)
self.txt_password.delete(0,END)
self.txt_cpassword.delete(0,END)
self.cmb_quest.current(0)

def register_data(self):
if self.txt_fname.get()=="" or self.txt_contact.get()=="" or
self.txt_email.get()=="" or self.cmb_quest.get()=="Select" or
self.txt_answer.get()=="" or self.txt_password.get()=="" or
self.txt_cpassword.get()=="":
messagebox.showerror("Error","All Fields Are
Required",parent=self.root)
elif self.txt_password.get()!=self.txt_cpassword.get():
messagebox.showerror("Error","Password & Confirm Password Should be
Same",parent=self.root)
elif self.var_chk.get()==0:
messagebox.showerror("Error","Please Agree terms &
Conditions",parent=self.root)
else:
try:
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
cur.execute("select * from employee where
email=?",(self.txt_email.get(),))
row=cur.fetchone()
#print(row)
if row!=None:
messagebox.showerror("Error","User Already Exist,Please
try with another email",parent=self.root)
Else:
cur.execute("insert into
employee(f_name,l_name,contact,email,question,answer,pa
ssword) values(?,?,?,?,?,?,?)",
(self.txt_fname.get(),
self.txt_lname.get(),
self.txt_contact.get(),
self.txt_email.get(),
self.cmb_quest.get(),
self.txt_answer.get(),
self.txt_password.get()
))
con.commit()
con.close()
messagebox.showinfo("Success","Register
Successful",parent=self.root)
self.clear()
except Exception as es:
messagebox.showerror("Error",f"Error due to:
{str(es)}",parent=self.root)

root=Tk()
obj=Register(root)
root.mainloop()

File2:login.py
from tkinter import*
from PIL import Image,ImageTk,ImageDraw #pip install Pillow
from datetime import*
import time
from math import*
import sqlite3
import os
from tkinter import messagebox,ttk
class Login_window:
def __init__(self,root):
self.root=root
self.root.title("GUI Analog Clock")
self.root.geometry("1350x700+0+0")
self.root.config(bg="#021e2f")

#========Background Colors===============
left_lbl=Label(self.root,bg="#08A3D2",bd=0)
left_lbl.place(x=0,y=0,relheight=1,width=600)
right_lbl=Label(self.root,bg="#031F3C",bd=0)
right_lbl.place(x=600,y=0,relheight=1,relwidth=1)
#=============Frames====================
login_frame=Frame(self.root,bg="white")
login_frame.place(x=250,y=100,width=800,height=500)

title=Label(login_frame,text="Login Here",font=("times new


roman",30,"bold"),bg="white",fg="#08A3D2").place(x=250,y=50)

email=Label(login_frame,text="EMAIL ADDRESS",font=("times new


roman",18,"bold"),bg="white",fg="gray").place(x=250,y=150)
self.txt_email=Entry(login_frame,font=("times new roman",15),bg="lightgray")
self.txt_email.place(x=250,y=180,width=350,height=35)

pass_=Label(login_frame,text="PASSWORD",font=("times new
roman",18,"bold"),bg="white",fg="gray").place(x=250,y=250)
self.txt_pass_=Entry(login_frame,font=("times new roman",15),bg="lightgray")
self.txt_pass_.place(x=250,y=280,width=350,height=35)

btn_reg=Button(login_frame,cursor="hand2",command=self.register_window,text="R
egister new Account?",font=("times new
roman",14),bg="white",bd=0,fg="#B00857").place(x=250,y=320)

btn_login=Button(login_frame,text="Login",command=self.login,font=("times new
roman",20,"bold"),fg="white",bg="#B00857",cursor="hand2").place(x=250,y=380,wi
dth=180,height=40)

#=====Clock==============
self.lbl=Label(self.root,text="\nClock",font=("Book
Antiqua",25,"bold"),fg="white",compound=BOTTOM,bg="#081923",bd=0)
self.lbl.place(x=90,y=120,height=450,width=350)
self.working()

def register_window(self):
self.root.destroy()
import register

def login(self):
if self.txt_email.get()==""or self.txt_pass_.get()=="":
messagebox.showerror("Error","All fields are required",parent=self.root)
else:
try:
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
ur.execute("select * from employee where email=? and
password=?",(self.txt_email.get(),self.txt_pass_.get()))
row=cur.fetchone()
if row==None:

messagebox.showerror("Error","Invalid USERNAME &


PASSWORD",parent=self.root)
else:
messagebox.showinfo("Success","Welcome!",parent=self.root)
self.root.destroy()
import dashboard
con.close()
except Exception as es:
messagebox.showerror("Error",f"Error Due to:
{str(es)}",parent=self.root)

def clock_image(self,hr,min_,sec_):
clock=Image.new("RGB",(400,400),(8,25,35))
draw=ImageDraw.Draw(clock)
#=========For Clock Image========
bg=Image.open("image//c.png")
bg=bg.resize((300,300))
clock.paste(bg,(50,50))
# Formula To Rotate the Anticlock
#angle_in_radians = angle_in_degrees *math.pi / 180
#line_length = 100
# center_x = 250
# center_y = 250
# end_x = center_x + line_lenth * math.cos(angle_in_radians)
# end_y = center_y - line_lenth * math.sin(angle_in_radians)

#=======HourLine Image===========
origin=200,200
draw.line((origin,200+50*sin(radians(hr)),200-50*cos(radians(hr))),fill="#DF00
5E",width=4)
#=======Min Line Image===========
draw.line((origin,200+80*sin(radians(min_)),200-80*cos(radians(min_))),fill="w
hite",width=3)
#=======Sec Line Image===========
draw.line((origin,200+100*sin(radians(sec_)),200-100*cos(radians(sec_))),fill=
"yellow",width=2)
draw.ellipse((195,195,210,210),fill="#1AD5D5")
clock.save("image//clock_new.png")

def working(self):
h=datetime.now().time().hour
m=datetime.now().time().minute
s=datetime.now().time().second
hr=(h/12)*360
min_=(m/60)*360
sec_=(s/60)*360

self.clock_image(hr,min_,sec_)
self.img=ImageTk.PhotoImage(file="image//clock_new.png")
self.lbl.config(image=self.img)
self.lbl.after(200,self.working)

root=Tk()
obj=Login_window(root)
root.mainloop()

File3:dashboard.py
from tkinter import*
from PIL import Image,ImageTk #pip install pillow
from course import CourseClass
from student import studentClass
from result import ResultClass
from report import reportClass
from tkinter import messagebox
import os
class RMS:
def __init__(self,root):
self.root=root
self.root.title("Student Result Managment System")
self.root.geometry("1350x700+0+0")
self.root.config(bg="white")
#=====icons======
self.logo_dash=ImageTk.PhotoImage(file=r"image\\logo_p.png")
#===title========
title=Label(self.root,text="Student Result Managment
System",padx=10,compound=LEFT,image=self.logo_dash,font=("goudy old
style",20,"bold"),bg="#033054",fg="white").place(x=0,y=0,relwidth=1,height=50)
#=====Menu=========
M_Frame=LabelFrame(self.root,text="Menus",font=("times new roman",15),bg="white")
M_Frame.place(x=10,y=70,width=1340,height=80)

btn_course=Button(M_Frame,text="Course",font=("goudy old
style",15,"bold"),bg="#0b5377",fg="white",cursor="hand2",command=self.add_cour
se).place(x=20,y=5,width=200,height=40)
btn_student=Button(M_Frame,text="Students",font=("goudy old
style",15,"bold"),bg="#0b5377",fg="white",cursor="hand2",command=self.add_stud
ent).place(x=240,y=5,width=200,height=40)
btn_result=Button(M_Frame,text="Result",font=("goudy old
style",15,"bold"),bg="#0b5377",fg="white",cursor="hand2",command=self.add_resu
lt).place(x=460,y=5,width=200,height=40)
btn_view=Button(M_Frame,text="View Student Result",font=("goudy old
style",15,"bold"),bg="#0b5377",fg="white",cursor="hand2",command=self.add_repo
rt).place(x=680,y=5,width=200,height=40)
btn_logout=Button(M_Frame,text="Logout",font=("goudy old
style",15,"bold"),bg="#0b5377",fg="white",cursor="hand2",command=self.logout).
place(x=900,y=5,width=200,height=40)
btn_exit=Button(M_Frame,text="Exit",font=("goudy old
style",15,"bold"),bg="#0b5377",fg="white",cursor="hand2",command=self.exit_).p
lace(x=1120,y=5,width=200,height=40)

#=====content_window======
self.bg_imag=Image.open(r"image\\bg.png")
self.bg_imag=self.bg_imag.resize((920,350),Image.Resampling.LANCZOS)
self.bg_imag=ImageTk.PhotoImage(self.bg_imag)

self.lbl_bg=Label(self.root,image=self.bg_imag).place(x=400,y=180,width=920,he
ight=350)

#======update_details=====
self.lbl_course=Label(self.root,text="Total Course\n[ 0 ]",font=("goudy old
style",20),bd=10,relief=RIDGE,bg="#e43b06",fg="white")
self.lbl_course.place(x=400,y=530,width=300,height=100)

self.lbl_student=Label(self.root,text="Total Student\n[ 0 ]",font=("goudy old


style",20),bd=10,relief=RIDGE,bg="#0676ad",fg="white")
self.lbl_student.place(x=710,y=530,width=300,height=100)

self.lbl_result=Label(self.root,text="Total Result\n[ 0 ]",font=("goudy old


style",20),bd=10,relief=RIDGE,bg="#038074",fg="white")
self.lbl_result.place(x=1020,y=530,width=300,height=100)

#=====footer========
footer=Label(self.root,text="SRMS-Student Result Managment System\nContact Us
for Any Technical issue :9313642455",font=("goudy old
style",12,),bg="#262626",fg="white").pack(side=BOTTOM,fill=X)

def add_course(self):
self.new_win=Toplevel(self.root)
self.new_obj=CourseClass(self.new_win)
def add_student(self):
self.new_win=Toplevel(self.root)
self.new_obj=studentClass(self.new_win)

def add_result(self):
self.new_win=Toplevel(self.root)
self.new_obj=ResultClass(self.new_win)

def add_report(self):
self.new_win=Toplevel(self.root)
self.new_obj=reportClass(self.new_win)

def logout(self):
op=messagebox.askyesno("Confirm","Do you really want to
logout?",parent=self.root)
if op==True:
self.root.destroy()
import login
def exit_(self):
op=messagebox.askyesno("Confirm","Do you really want to Exit?",parent=self.root)
if op==True:
self.root.destroy()

#if __name__=="__main__":
root=Tk()
obj=RMS(root)
root.mainloop()
File4:create_db.py
import sqlite3
def create_db():
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS course(cid INTEGER PRIMARY KEY
AUTOINCREMENT,name text,duration text,charges float,description text)")
con.commit()

cur.execute("CREATE TABLE IF NOT EXISTS student(roll INTEGER PRIMARY KEY


AUTOINCREMENT,name text,email text,gender text,dob text,contact text,admission
text,course text,state text,city text,pin text,address text)")
con.commit()

cur.execute("CREATE TABLE IF NOT EXISTS result(rid INTEGER PRIMARY KEY


AUTOINCREMENT,roll text,name text,course text,marks_ob text,full_marks
text,per text)")
con.commit()

cur.execute("CREATE TABLE IF NOT EXISTS employee(eid INTEGER PRIMARY KEY


AUTOINCREMENT,f_name text,l_name text,contact text,email text,question
text,answer text,password text)")
con.commit()

con.close()

create_db()
File5:course.py
from tkinter import*
from PIL import Image,ImageTk #pip install pillow
from tkinter import ttk,messagebox
import sqlite3
class CourseClass:
def __init__(self,root):
self.root=root
self.root.title("Srudent Result Managment system")
self.root.geometry("1200x480+80+170")
self.root.config(bg="white")
self.root.focus_force()
#===title=====
title=Label(self.root,text="Manage Course Details",font=("goudy old
style",20,"bold"),bg="#033054",fg="white").place(x=10,y=15,width=1180,he
ight=35)
#=========variables============
self.var_course=StringVar()
self.var_duration=StringVar()
self.var_charges=StringVar()

#========Widgets===============
lbl_courseName=Label(self.root,text="Course Name",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=60)
lbl_duration=Label(self.root,text="Duration",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=100)
lbl_charges=Label(self.root,text="Charges",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=140)

lbl_description=Label(self.root,text="Description",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=180)

#====Entry Fields==========

self.txt_corseName=Entry(self.root,textvariable=self.var_course,font=("g
oudy old style",15,"bold"),bg="lightyellow")
self.txt_corseName.place(x=150,y=60,width=200)
txt_duration=Entry(self.root,textvariable=self.var_duration,font=("goudy
old style",15,"bold"),bg="lightyellow").place(x=150,y=100,width=200)

txt_charges=Entry(self.root,textvariable=self.var_charges,font=("goudy
old style",15,"bold"),bg="lightyellow").place(x=150,y=140,width=200)
self.txt_desription=Text(self.root,font=("goudy old
style",15,"bold"),bg="lightyellow")
self.txt_desription.place(x=150,y=180,width=500,height=130)

#=======buttons============
self.btn_add=Button(self.root,text='Save',font=("goudy old
style",15,"bold"),bg="#2196f3",fg="white",cursor="hand2",command=self.ad
d)
self.btn_add.place(x=150,y=400,width=110,height=40)
self.btn_update=Button(self.root,text='Update',font=("goudy old
style",15,"bold"),bg="#4caf50",fg="white",cursor="hand2",command=self.up
date)
self.btn_update.place(x=270,y=400,width=110,height=40)

self.btn_delete=Button(self.root,text='Delete',font=("goudy old
style",15,"bold"),bg="#f44336",fg="white",cursor="hand2",command=self.de
lete)
self.btn_delete.place(x=390,y=400,width=110,height=40)

self.btn_clear=Button(self.root,text='Clear',font=("goudy old
style",15,"bold"),bg="#607d8b",fg="white",cursor="hand2",command=self.cl
ear)
self.btn_clear.place(x=510,y=400,width=110,height=40)

#=========Search Panel================
self.var_search=StringVar()
lbl_search_courseName=Label(self.root,text="Course Name",font=("goudy
old style",15,"bold"),bg="white").place(x=720,y=60)

txt_search_corseName=Entry(self.root,textvariable=self.var_search,font=(
"goudy old
style",15,"bold"),bg="lightyellow").place(x=870,y=60,width=180)
btn_search=Button(self.root,text='Search',font=("goudy old
style",15,"bold"),bg="#03a9f4",fg="white",cursor="hand2",command=self.se
arch).place(x=1070,y=60,width=120,height=28)
#=============content================
self.C_Frame=Frame(self.root,bd=2,relief=RIDGE)
self.C_Frame.place(x=720,y=100,width=470,height=340)

scrolly=Scrollbar(self.C_Frame,orient=VERTICAL)
scrollx=Scrollbar(self.C_Frame,orient=HORIZONTAL)
self.CourseTable=ttk.Treeview(self.C_Frame,columns=("cid","name","durati
on","charges","desription"),xscrollcommand=scrollx.set,yscrollcommand=sc
rolly.set)

scrollx.pack(side=BOTTOM,fill=X)
scrolly.pack(side=RIGHT,fill=Y)
scrollx.config(command=self.CourseTable.xview)
scrolly.config(command=self.CourseTable.yview)

self.CourseTable.heading("cid",text="Course ID")
self.CourseTable.heading("name",text="Name")
self.CourseTable.heading("duration",text="Duration")
self.CourseTable.heading("charges",text="Charges")
self.CourseTable.heading("desription",text="Desription")
self.CourseTable["show"]='headings'
self.CourseTable.column("cid",width=100)
self.CourseTable.column("name",width=100)
self.CourseTable.column("duration",width=100)
self.CourseTable.column("charges",width=100)
self.CourseTable.column("desription",width=150)
self.CourseTable.pack(fill=BOTH,expand=1)
self.CourseTable.bind("<ButtonRelease-1>",self.get_data)
self.show()

#=================================================
def clear(self):
self.show()
self.var_course.set("")
self.var_duration.set("")
self.var_charges.set("")
self.var_search.set("")
self.txt_desription.delete('1.0',END)
self.txt_corseName.config(state=NORMAL)

def delete(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_course.get()=="":
messagebox.showerror("Error","Course Name Should be
Required",parent=self.root)
Else:
cur.execute("select * from course where
name=?",(self.var_course.get(),))
row=cur.fetchone()
if row==None:
messagebox.showerror("Error","please select Course from
the list first",parent=self.root)
Else:
op=messagebox.askyesno("Confirm","Do you really want to
delete?",parent=self.root)
if op==True:
cur.execute("delete from course where
name=?",(self.var_course.get(),))
con.commit()
messagebox.showinfo("Delete","Course deleted
Successfully",parent=self.root)
self.clear()

except Exception as ex:


messagebox.showerror("Error",f"Error due to {str(ex)}")

def get_data(self,ev):
self.txt_corseName.config(state='readonly')
r=self.CourseTable.focus()
content=self.CourseTable.item(r)
row=content["values"]
#print(row)
self.var_course.set(row[1])
self.var_duration.set(row[2])
self.var_charges.set(row[3])
#self.var_course.set(row[4])
self.txt_desription.delete('1.0',END)
self.txt_desription.insert(END,row[4])

def add(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_course.get()=="":
messagebox.showerror("Error","Course Name Should be
Required",parent=self.root)
Else:
cur.execute("select * from course where
name=?",(self.var_course.get(),))
row=cur.fetchone()
if row!=None:
messagebox.showerror("Error","Course Name already
present",parent=self.root)
Else:
cur.execute("insert into course
(name,duration,charges,description) values(?,?,?,?)",(
self.var_course.get(),
self.var_duration.get(),
self.var_charges.get(),
self.txt_desription.get("1.0",END)
))
con.commit()
messagebox.showinfo("Success","Course Added
Successfully",parent=self.root)
self.show()
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def update(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_course.get()=="":
messagebox.showerror("Error","Course Name Should be
Required",parent=self.root)
Else:
cur.execute("select * from course where
name=?",(self.var_course.get(),))
row=cur.fetchone()
if row==None:
messagebox.showerror("Error","Select Course from
list",parent=self.root)
Else:
cur.execute("update course set
duration=?,charges=?,description=? where name=?",(
self.var_duration.get(),
self.var_charges.get(),
self.txt_desription.get("1.0",END),
self.var_course.get()
))
con.commit()

messagebox.showinfo("Success","Course Update
Successfully",parent=self.root)
self.show()
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def show(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
cur.execute("select * from course ")
rows=cur.fetchall()
self.CourseTable.delete(*self.CourseTable.get_children())
for row in rows:
self.CourseTable.insert('',END,values=row)
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def search(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
Try:
cur.execute(f"select * from course where name like
'%{self.var_search.get()}%'")
rows=cur.fetchall()
self.CourseTable.delete(*self.CourseTable.get_children())
for row in rows:
self.CourseTable.insert('',END,values=row)
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

if __name__=="__main__":
root=Tk()
obj=CourseClass(root)
root.mainloop()
File6:student.py
from tkinter import*
from PIL import Image,ImageTk #pip install pillow
from tkinter import ttk,messagebox
import sqlite3
class studentClass:
def __init__(self,root):
self.root=root
self.root.title("Srudent Result Managment system")
self.root.geometry("1200x480+80+170")
self.root.config(bg="white")
self.root.focus_force()
#===title=====
title=Label(self.root,text="Manage Course Details",font=("goudy old
style",20,"bold"),bg="#033054",fg="white").place(x=10,y=15,width=1180,he
ight=35)
#=========variables============
self.var_roll=StringVar()
self.var_name=StringVar()
self.var_email=StringVar()
self.var_gender=StringVar()
self.var_dob=StringVar()
self.var_duration=StringVar()
self.var_contact=StringVar()
self.var_course=StringVar()
self.var_a_date=StringVar()
self.var_state=StringVar()
self.var_pin=StringVar()
self.var_city=StringVar()

#========Widgets===============
#========column1===============
lbl_roll=Label(self.root,text="Roll No.",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=60)
lbl_name=Label(self.root,text="Name",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=100)
lbl_Email=Label(self.root,text="Email",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=140)
lbl_gender=Label(self.root,text="Gender",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=180)
lbl_state=Label(self.root,text="State",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=220)

txt_state=Entry(self.root,textvariable=self.var_state,font=("goudy old
style",15,"bold"),bg="lightyellow").place(x=150,y=220,width=150)

lbl_city=Label(self.root,text="City",font=("goudy old
style",15,"bold"),bg="white").place(x=310,y=220)

txt_city=Entry(self.root,textvariable=self.var_city,font=("goudy old
style",15,"bold"),bg="lightyellow").place(x=380,y=220,width=100)

lbl_pin=Label(self.root,text="Pin",font=("goudy old
style",15,"bold"),bg="white").place(x=500,y=220)

txt_pin=Entry(self.root,textvariable=self.var_pin,font=("goudy old
style",15,"bold"),bg="lightyellow").place(x=560,y=220,width=120)

lbl_address=Label(self.root,text="Address",font=("goudy old
style",15,"bold"),bg="white").place(x=10,y=260)

#====Entry Fields==========

self.txt_roll=Entry(self.root,textvariable=self.var_roll,font=("goudy
old style",15,"bold"),bg="lightyellow")
self.txt_roll.place(x=150,y=60,width=200)

txt_name=Entry(self.root,textvariable=self.var_name,font=("goudy old
style",15,"bold"),bg="lightyellow").place(x=150,y=100,width=200)

txt_email=Entry(self.root,textvariable=self.var_email,font=("goudy old
style",15,"bold"),bg="lightyellow").place(x=150,y=140,width=200)

self.txt_gender=ttk.Combobox(self.root,textvariable=self.var_gender,valu
es=("Select","Male","Female","Other"),font=("goudy old
style",15,"bold"),state='readonly',justify=CENTER)
self.txt_gender.place(x=150,y=180,width=200)
self.txt_gender.current(0)

#========column2===============
lbl_dob=Label(self.root,text="D.O.B",font=("goudy old
style",15,"bold"),bg="white").place(x=360,y=60)
lbl_contact=Label(self.root,text="Contact",font=("goudy old
style",15,"bold"),bg="white").place(x=360,y=100)

lbl_addmission=Label(self.root,text="Addmission",font=("goudy old
style",15,"bold"),bg="white").place(x=360,y=140)
lbl_course=Label(self.root,text="Course",font=("goudy old
style",15,"bold"),bg="white").place(x=360,y=180)

#====Entry Fields==========
self.course_list=[]
#function call to update list
self.fetch_course()

self.txt_dob=Entry(self.root,textvariable=self.var_dob,font=("goudy old
style",15,"bold"),bg="lightyellow").place(x=480,y=60,width=200)

txt_contact=Entry(self.root,textvariable=self.var_contact,font=("goudy
old style",15,"bold"),bg="lightyellow").place(x=480,y=100,width=200)

txt_addmission=Entry(self.root,textvariable=self.var_a_date,font=("goudy
old style",15,"bold"),bg="lightyellow").place(x=480,y=140,width=200)

self.txt_course=ttk.Combobox(self.root,textvariable=self.var_course,valu
es=self.course_list,font=("goudy old
style",15,"bold"),state='readonly',justify=CENTER)
self.txt_course.place(x=480,y=180,width=200)
self.txt_course.set("Select")

#====Text Address==========

self.txt_address=Text(self.root,font=("goudy old
style",15,"bold"),bg="lightyellow")
self.txt_address.place(x=150,y=260,width=540,height=100)

#=======buttons============
self.btn_add=Button(self.root,text='Save',font=("goudy old
style",15,"bold"),bg="#2196f3",fg="white",cursor="hand2",command=self.ad
d)
self.btn_add.place(x=150,y=400,width=110,height=40)

self.btn_update=Button(self.root,text='Update',font=("goudy old
style",15,"bold"),bg="#4caf50",fg="white",cursor="hand2",command=self.up
date)
self.btn_update.place(x=270,y=400,width=110,height=40)
self.btn_delete=Button(self.root,text='Delete',font=("goudy old
style",15,"bold"),bg="#f44336",fg="white",cursor="hand2",command=self.de
lete)
self.btn_delete.place(x=390,y=400,width=110,height=40)

self.btn_clear=Button(self.root,text='Clear',font=("goudy old
style",15,"bold"),bg="#607d8b",fg="white",cursor="hand2",command=self.cl
ear)
self.btn_clear.place(x=510,y=400,width=110,height=40)

#=========Search Panel================

self.var_search=StringVar()
lbl_search_roll=Label(self.root,text="Roll No.",font=("goudy old
style",15,"bold"),bg="white").place(x=720,y=60)

txt_search_roll=Entry(self.root,textvariable=self.var_search,font=("goud
y old style",15,"bold"),bg="lightyellow").place(x=870,y=60,width=180)
btn_search=Button(self.root,text='Search',font=("goudy old
style",15,"bold"),bg="#03a9f4",fg="white",cursor="hand2",command=self.se
arch).place(x=1070,y=60,width=120,height=28)

#=============content================

self.C_Frame=Frame(self.root,bd=2,relief=RIDGE)
self.C_Frame.place(x=720,y=100,width=470,height=340)

scrolly=Scrollbar(self.C_Frame,orient=VERTICAL)
scrollx=Scrollbar(self.C_Frame,orient=HORIZONTAL)

self.CourseTable=ttk.Treeview(self.C_Frame,columns=("roll","name","email
","gender","dob","contact","admission","course","state","city","pin","ad
dress"),xscrollcommand=scrollx.set,yscrollcommand=scrolly.set)

scrollx.pack(side=BOTTOM,fill=X)
scrolly.pack(side=RIGHT,fill=Y)
scrollx.config(command=self.CourseTable.xview)
scrolly.config(command=self.CourseTable.yview)

self.CourseTable.heading("roll",text="Roll No.")
self.CourseTable.heading("name",text="Name")
self.CourseTable.heading("email",text="Email")
self.CourseTable.heading("gender",text="Gender")
self.CourseTable.heading("dob",text="D.O.B")
self.CourseTable.heading("contact",text="Contact")
self.CourseTable.heading("admission",text="Admission")
self.CourseTable.heading("course",text="Course")
self.CourseTable.heading("state",text="State")
self.CourseTable.heading("city",text="City")
self.CourseTable.heading("pin",text="PIN")
self.CourseTable.heading("address",text="Address")
self.CourseTable["show"]='headings'
self.CourseTable.column("roll",width=100)
self.CourseTable.column("name",width=100)
self.CourseTable.column("email",width=100)
self.CourseTable.column("gender",width=100)
self.CourseTable.column("dob",width=100)
self.CourseTable.column("contact",width=100)
self.CourseTable.column("admission",width=100)
self.CourseTable.column("course",width=100)
self.CourseTable.column("state",width=100)
self.CourseTable.column("city",width=100)
self.CourseTable.column("pin",width=100)
self.CourseTable.column("address",width=100)
self.CourseTable.pack(fill=BOTH,expand=1)
self.CourseTable.bind("<ButtonRelease-1>",self.get_data)
self.show()

#=================================================

def clear(self):
self.show()
self.var_roll.set("")
self.var_name.set("")
self.var_email.set("")
self.var_gender.set("Select")
self.var_dob.set("")
self.var_contact.set("")
self.var_a_date.set("")
self.var_course.set("Select")
self.var_state.set("")
self.var_city.set("")
self.var_pin.set("")
self.txt_address.delete("1.0",END)
self.txt_roll.config(state=NORMAL)
self.var_search.set("")

def delete(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_roll.get()=="":
messagebox.showerror("Error","Roll No. Should be
Required",parent=self.root)
Else:
cur.execute("select * from student where
roll=?",(self.var_roll.get(),))
row=cur.fetchone()
if row==None:
messagebox.showerror("Error","please select student
from the list first",parent=self.root)
Else:
op=messagebox.askyesno("Confirm","Do you really want to
delete?",parent=self.root)
if op==True:
cur.execute("delete from student where
roll=?",(self.var_roll.get(),))
con.commit()
messagebox.showinfo("Delete","Student deleted
Successfully",parent=self.root)
self.clear()

except Exception as ex:


messagebox.showerror("Error",f"Error due to {str(ex)}")

def get_data(self,ev):
self.txt_roll.config(state='readonly')
r=self.CourseTable.focus()
content=self.CourseTable.item(r)
row=content["values"]
self.var_roll.set(row[0])
self.var_name.set(row[1])
self.var_email.set(row[2])
self.var_gender.set(row[3])
self.var_dob.set(row[4])
self.var_contact.set(row[5])
self.var_a_date.set(row[6])
self.var_course.set(row[7])
self.var_state.set(row[8])
self.var_city.set(row[9])
self.var_pin.set(row[10])
self.txt_address.delete("1.0",END)
self.txt_address.insert(END,row[11])

def add(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_roll.get()=="":
messagebox.showerror("Error","Roll Number Should be
Required",parent=self.root)
Else:
cur.execute("select * from student where
roll=?",(self.var_roll.get(),))
row=cur.fetchone()
if row!=None:
messagebox.showerror("Error","Roll Number already
present",parent=self.root)
Else:
cur.execute("insert into
student(roll,name,email,gender,dob,contact,admission,co
urse,state,city,pin,address)
values(?,?,?,?,?,?,?,?,?,?,?,?)",(
self.var_roll.get(),
self.var_name.get(),
self.var_email.get(),
self.var_gender.get(),
self.var_dob.get(),
self.var_contact.get(),
self.var_a_date.get(),
self.var_course.get(),
self.var_state.get(),
self.var_city.get(),
self.var_pin.get(),
self.txt_address.get("1.0",END)
))
con.commit()

messagebox.showinfo("Success","Student Added
Successfully",parent=self.root)
self.show()
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def update(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_roll.get()=="":
messagebox.showerror("Error","Roll No. Should be
Required",parent=self.root)
Else:
cur.execute("select * from student where
roll=?",(self.var_roll.get(),))
row=cur.fetchone()
if row==None:
messagebox.showerror("Error","Select student from
list",parent=self.root)
Else:
cur.execute("update student set
name=?,email=?,gender=?,dob=?,contact=?,admission=?,cou
rse=?,state=?,city=?,pin=?,address=? where roll=?",(
self.var_name.get(),
self.var_email.get(),
self.var_gender.get(),
self.var_dob.get(),
self.var_contact.get(),
self.var_a_date.get(),
self.var_course.get(),
self.var_state.get(),
self.var_city.get(),
self.var_pin.get(),
self.txt_address.get("1.0",END),
self.var_roll.get(),
))
con.commit()

messagebox.showinfo("Success","Student Update
Successfully",parent=self.root)
self.show()
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def show(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
cur.execute("select * from student ")
rows=cur.fetchall()
self.CourseTable.delete(*self.CourseTable.get_children())
for row in rows:
self.CourseTable.insert('',END,values=row)
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def fetch_course(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
cur.execute("select name from course ")
rows=cur.fetchall()
if len(rows)>0:
for row in rows:
self.course_list.append(row[0])
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def search(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
Try:
cur.execute(f"select * from student where
roll=?",(self.var_search.get(),))
row=cur.fetchone()
if row!=None:
self.CourseTable.delete(*self.CourseTable.get_children())
self.CourseTable.insert('',END,values=row)
Else:
messagebox.showerror("Error","No record
found",parent=self.root)
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

if __name__=="__main__":
root=Tk()
onj=studentClass(root)
root.mainloop()

File7:result.py
from tkinter import*
from PIL import Image,ImageTk #pip install pillow
from tkinter import ttk,messagebox
import sqlite3
class ResultClass:
def __init__(self,root):
self.root=root
self.root.title("Student Result Managment system")
self.root.geometry("1200x480+80+170")
self.root.config(bg="white")
self.root.focus_force()
#===title=====
title=Label(self.root,text="Add Student Result",font=("goudy old
style",20,"bold"),bg="orange",fg="#262626").place(x=10,y=15,width=1180,h
eight=50)
#===variables===
self.var_roll=StringVar()
self.var_name=StringVar()
self.var_course=StringVar()
self.var_marks=StringVar()
self.var_full_marks=StringVar()
self.roll_list=[]
self.fetch_roll()

#===widgets=====

lbl_select=Label(self.root,text="Select Student",font=("goudy old


style",20,"bold"),bg="white").place(x=50,y=100)
lbl_name=Label(self.root,text="Name",font=("goudy old
style",20,"bold"),bg="white").place(x=50,y=160)
lbl_course=Label(self.root,text="Course",font=("goudy old
style",20,"bold"),bg="white").place(x=50,y=220)
lbl_marks_ob=Label(self.root,text="Marks Obtained",font=("goudy old
style",20,"bold"),bg="white").place(x=50,y=280)
lbl_full_marks=Label(self.root,text="Full Marks",font=("goudy old
style",20,"bold"),bg="white").place(x=50,y=340)

self.txt_student=ttk.Combobox(self.root,textvariable=self.var_roll,value
s=self.roll_list,font=("goudy old
style",15,"bold"),state='readonly',justify=CENTER)
self.txt_student.place(x=280,y=100,width=200)
self.txt_student.set("Select")
btn_search=Button(self.root,text='Search',font=("goudy old
style",15,"bold"),bg="#03a9f4",fg="white",cursor="hand2",command=self.se
arch).place(x=500,y=100,width=100,height=28)

txt_name=Entry(self.root,textvariable=self.var_name,font=("goudy old
style",20,"bold"),bg="lightyellow",state='readonly').place(x=280,y=160,w
idth=320)

txt_course=Entry(self.root,textvariable=self.var_course,font=("goudy old
style",20,"bold"),bg="lightyellow",state='readonly').place(x=280,y=220,w
idth=320)

txt_marks=Entry(self.root,textvariable=self.var_marks,font=("goudy old
style",20,"bold"),bg="lightyellow",).place(x=280,y=280,width=320)

txt_full_marks=Entry(self.root,textvariable=self.var_full_marks,font=("g
oudy old
style",20,"bold"),bg="lightyellow").place(x=280,y=340,width=320)
#===Button=====

btn_add=Button(self.root,text="Submit",font=("times new
roman",15),bg='lightgreen',activebackground='lightgreen',cursor="hand2",
command=self.add).place(x=300,y=420,width=120,height=35)
btn_clear=Button(self.root,text="Clear",font=("times new
roman",15),bg='lightgray',activebackground='white',cursor="hand2",comman
d=self.clear).place(x=430,y=420,width=120,height=35)

#===image=====

self.bg_imag=Image.open(r"image\\result.jpg")
self.bg_imag=self.bg_imag.resize((500,300),Image.Resampling.LANCZOS)
self.bg_imag=ImageTk.PhotoImage(self.bg_imag)

self.lbl_bg=Label(self.root,image=self.bg_imag).place(x=650,y=100)

#==================================

def fetch_roll(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
cur.execute("select roll from student ")
rows=cur.fetchall()
if len(rows)>0:
for row in rows:
self.roll_list.append(row[0])
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def search(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
Try:
cur.execute(f"select name,course from student where
roll=?",(self.var_roll.get(),))
row=cur.fetchone()
if row!=None:
self.var_name.set(row[0])
self.var_course.set(row[1])
else:
messagebox.showerror("Error","No record found",parent=self.root)
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")
def add(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_name.get()=="":
messagebox.showerror("Error","please first search student
record",parent=self.root)
Else:
cur.execute("select * from result where roll=? and
course=?",(self.var_roll.get(),self.var_course.get()))
row=cur.fetchone()
if row!=None:
messagebox.showerror("Error","Result already
present",parent=self.root)
Else:

per=(int(self.var_marks.get())*100)/int(self.var_full_marks.g
et())
cur.execute("insert into result
(roll,name,course,marks_ob,full_marks,per)
values(?,?,?,?,?,?)",(
self.var_roll.get(),
self.var_name.get(),
self.var_course.get(),
self.var_marks.get(),
self.var_full_marks.get(),
str(per)
))
con.commit()

messagebox.showinfo("Success","Result Added
Successfully",parent=self.root)
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def clear(self):
self.var_roll.set("Select")
self.var_name.set("")
self.var_course.set("")
self.var_marks.set("")
self.var_full_marks.set("")

if __name__=="__main__":
root=Tk()
onj=ResultClass(root)
root.mainloop()
File8:report.py

from tkinter import*


from PIL import Image,ImageTk #pip install pillow
from tkinter import ttk,messagebox
import sqlite3
class reportClass:
def __init__(self,root):
self.root=root
self.root.title("Srudent Result Managment system")
self.root.geometry("1200x480+80+170")
self.root.config(bg="white")
self.root.focus_force()
#===title=====
title=Label(self.root,text="View Student Result",font=("goudy old
style",20,"bold"),bg="orange",fg="#262626").place(x=10,y=15,width=1180,h
eight=50)

#===search======
self.var_search=StringVar()
self.var_id=""

lbl_search=Label(self.root,text="Search By Roll No.",font=("goudy old


style",20,"bold"),bg="white").place(x=300,y=100)

lbl_search=Entry(self.root,textvariable=self.var_search,font=("goudy old
style",20,),bg="lightyellow").place(x=520,y=100,width=150)
btn_search=Button(self.root,text='Search',font=("goudy old
style",15,"bold"),bg="#03a9f4",fg="white",cursor="hand2",command=self.se
arch).place(x=680,y=100,width=100,height=35)
btn_clear=Button(self.root,text='Clear',font=("goudy old
style",15,"bold"),bg="gray",fg="white",cursor="hand2",command=self.clear
).place(x=800,y=100,width=100,height=35)

#===result_labels=====
lbl_roll=Label(self.root,text="Roll No",font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE).place(x=150,y=230,width
=150,height=50)
lbl_name=Label(self.root,text="Name",font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE).place(x=300,y=230,width
=150,height=50)
lbl_course=Label(self.root,text="Course",font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE).place(x=450,y=230,width
=150,height=50)
lbl_marks=Label(self.root,text="Marks Obtained",font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE).place(x=600,y=230,width
=150,height=50)
lbl_full=Label(self.root,text="Total Marks",font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE).place(x=750,y=230,width
=150,height=50)
lbl_per=Label(self.root,text="Percentage",font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE).place(x=900,y=230,width
=150,height=50)

self.roll=Label(self.root,font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE)
self.roll.place(x=150,y=280,width=150,height=50)
self.name=Label(self.root,font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE)
self.name.place(x=300,y=280,width=150,height=50)
self.course=Label(self.root,font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE)
self.course.place(x=450,y=280,width=150,height=50)
self.marks=Label(self.root,font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE)
self.marks.place(x=600,y=280,width=150,height=50)
self.full=Label(self.root,font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE)
self.full.place(x=750,y=280,width=150,height=50)
self.per=Label(self.root,font=("goudy old
style",15,"bold"),bg="white",bd=2,relief=GROOVE)
self.per.place(x=900,y=280,width=150,height=50)

#===button delete=====
btn_delete=Button(self.root,text='Delete',font=("goudy old
style",15,"bold"),bg="red",fg="white",cursor="hand2",command=self.delete
).place(x=500,y=350,width=150,height=35)
#=====================================================
def search(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_search.get()=="":
messagebox.showerror("Error","Roll No. should be
required",parent=self.root)
Else:
cur.execute(f"select * from result where
roll=?",(self.var_search.get(),))
row=cur.fetchone()
if row!=None:
self.var_id=row[0]
self.roll.config(text=row[1])
self.name.config(text=row[2])
self.course.config(text=row[3])
self.marks.config(text=row[4])
self.full.config(text=row[5])
self.per.config(text=row[6])
Else:
messagebox.showerror("Error","No record
found",parent=self.root)
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

def clear(self):
self.var_id=""
self.roll.config(text="")
self.name.config(text="")
self.course.config(text="")
self.marks.config(text="")
self.full.config(text="")
self.per.config(text="")
self.var_search.set("")

def delete(self):
con=sqlite3.connect(database="rms.db")
cur=con.cursor()
try:
if self.var_id=="":
messagebox.showerror("Error","Search Student result
first",parent=self.root)
Else:
cur.execute("select * from result where
rid=?",(self.var_id,))
row=cur.fetchone()
if row==None:

messagebox.showerror("Error","Invalid Student
Result",parent=self.root)
Else:

op=messagebox.askyesno("Confirm","Do you really want to


delete?",parent=self.root)
if op==True:
cur.execute("delete from result where
rid=?",(self.var_id,))
con.commit()
messagebox.showinfo("Delete","Result deleted
Successfully",parent=self.root)
self.clear()
except Exception as ex:
messagebox.showerror("Error",f"Error due to {str(ex)}")

if __name__=="__main__":
root=Tk()
onj=reportClass(root)
root.mainloop()
OUTPUT

You might also like