CBSE COMPUTER
PROJECT
(Student Marksheet Generator)
BY:-
SANDEEP P NAIR
XII – B
Page | 1
INDEX
Sl no: Title Pg no:
1 Acknowledgement 3
2 Synopsis 4
3 Program Code 8
4 Outputs 34
5 Bibliography 41
Page | 2
Acknowledgment
I would like to express my heartfelt gratitude
to Almighty God for giving me the strength,
knowledge, and opportunity to undertake and
complete this Computer Science project. I am
deeply thankful to our esteemed Principal,
Ms.Prathiba V, for providing a conducive
learning environment and continuous support.
I extend my sincere thanks to my dedicated
Computer Science Teacher, Ms.Nirmala.P,
whose invaluable guidance, patience, and
expertise have been instrumental in the
successful completion of this project. Their
encouragement and assistance have been truly
inspiring, enabling me to enhance my skills
and knowledge in the field of Computer
Science.
Page | 3
SYNOPSIS
SUMMARY:-
The project is about arranging the order of students in
the correct rankings based on the marks they have
scored in their exams. The program will also be able to
manipulate marksheet file by various options like
add,update,delete and search. Lastly, the program is
made through python language
. WORKING:-
• At the first window it will ask user to input the no: of
students and no: of subjects.
• In the 2nd window it will ask the user to input the
subjects.
• In the 3rd window the user has to input the details
like name of student, roll no:, class, division and marks
scored in the subjects. The details have to be entered
individually for each student.
• The 4 th window will give us the table of rankings
after calculating their percentages with their name and
marks of each subjects in a csv file.
After that we can manipulate the file by certain
functions like add,delete,search and update
Page | 4
Page | 5
The manipulation options:-
i) Add
Uses input details window as primary window
After adding data it will be reflected in the file
Page | 6
ii) Delete
Enter hallticket no:
After entering the no: the student data will
deleted from the file if it is available
iii) Update
uses the same the delete window ui for updating
the record of a student which gets reflected in
the csv file
iii) Search
uses the same the delete window ui for searching a
record of a student which gets reflected in
the csv file
Page | 7
PROGRAM CODE
FILE 1:-
from tkinter import *
from tkinter import messagebox
import customtkinter as ct
import csv
a=''
def Submit():
user1=entry1.get()
user2=entry2.get()
if user1.isnumeric()==False or
user2.isnumeric==False:
messagebox.showinfo(title='info',message='Only
accepts Numbers')
else:
global no_students
no_students=int(user1)
global no_subjects
no_subjects=int(user2)
window.destroy()
def delt():
entry1.delete(0,END)
entry2.delete(0,END)
def add():
b=[]
global a
window3.destroy()
with open(a,'r') as f:
read = csv.reader(f)
Page | 8
data =[]
for i in read:
print(read.line_num)
if read.line_num==1:
w=i
else:
data.append(i)
y=(len(w)-4)-5
print('hiiii',b)
def save():
total,avg=0,0
global x
x=0
stud_list1,stud_list2,prim_details = [],
[],[]
if not name.get().isnumeric() and
cb_rollno.get().isnumeric():
stud_list1 =
[name.get(),cb_rollno.get(),total,avg]
for idx,entry in enumerate(l):
if entry.get().isnumeric():
n=int(entry.get())
stud_list1[2]+=n
stud_list1.append(entry.get())
print(total)
entry.delete(0,'end')
else:
messagebox.showinfo(message="Only numbers are
allowed")
stud_list1[3]=stud_list1[2]/y
else:
Page | 9
messagebox.showinfo(message='Inappropriate
characters are entered')
name.delete(0,'end')
cb_rollno.delete(0,'end')
if stud_list1[2]/y >= 90:
stud_list1.append('A1')
elif stud_list1[2]/y >= 80:
stud_list1.append('A2')
elif stud_list1[2]/y >= 70:
stud_list1.append('B1')
elif stud_list1[2]/y >= 60:
stud_list1.append('B2')
elif stud_list1[2]/y >= 50:
stud_list1.append('C1')
elif stud_list1[2]/y < 50:
stud_list1.append('C2')
stud_list1.insert(0,len(w))
stud_list2.append(stud_list1)
print(stud_list2)
stud_list1.append(clas.get())
stud_list1.append(div.get())
stud_list1.append(day.get()
+'/'+month.get()+'/'+year.get())
data.append(stud_list1)
print(prim_details)
window_3.destroy()
c,rank=[],[]
global a
with open(a,'w',newline='') as f:
csv_w=csv.writer(f,delimiter=',')
csv_w.writerow(w)
s=0
print(data)
r=[]
for i in data:
c.append(int(i[3]))
c.sort(reverse=True)
Page | 10
print(c)
for i in range(len(c)):
for j in data:
if c[i]==int(j[3]):
if j not in r:
print(j)
s+=1
j.pop(0)
j.insert(0,s)
csv_w.writerow(j)
r.append(j)
window_3=ct.CTk()
ct.set_appearance_mode('dark')
window4=ct.CTk()
window_3.geometry('700x700')
window_3.title('Students Details')
window_3.resizable(height=False,width=False)
doblabel=ct.CTkLabel(window_3,text='DOB:-',font=(
'Calliber',20,'bold'))
label1=ct.CTkLabel(window_3,text='Name :-',font=(
'Calliber',20,'bold'))
label2=ct.CTkLabel(window_3,text='RollNo:-',font=
('Calliber',20,'bold'))
label3=ct.CTkLabel(window_3,text='Class:-',font=(
'Calliber',20,'bold'))
label4=ct.CTkLabel(window_3,text='Division:-',fon
t=('Calliber',20,'bold'))
label1.place(x=40,y=50)
label2.place(x=40,y=110)
label3.place(x=40,y=170)
Page | 11
label4.place(x=360,y=175)
doblabel.place(x=40,y=230)
name=ct.CTkEntry(window_3,height=20,width=300,fon
t=('Calliber',20,'bold'),fg_color='light
blue',border_color='red',
text_color='black')
name.place(x=180,y=50)
cb_rollno=ct.CTkEntry(window_3,font=('Calliber',2
0,'bold'),fg_color='light
blue',border_color='red',
text_color='black',height=20,width=300
)
cb_rollno.place(x=180,y=110)
div1=['A','B','C','D']
div=ct.CTkComboBox(window_3,
values=div1)
class1=['X','XII']
clas=ct.CTkComboBox(window_3,
values=class1)
clas.place(x=180,y=175)
dayval=['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20'
,'21','22','23','24','25','26','27','28','29','30
','31']
monthval=['Jan','Feb','Mar','April','May','Jun','
Jul','Aug','Sep','Oct','Nov','Dec']
yearval =
['2004','2005','2006','2007','2008','2009']
div.place(x=515,y=175)
day = ct.CTkComboBox(window_3,values=dayval)
Page | 12
month =
ct.CTkComboBox(window_3,values=monthval)
year =
ct.CTkComboBox(window_3,values=yearval)
day.place(x=140,y=230)
month.place(x=290,y=230)
year.place(x=440,y=230)
l=[]
p,b=0,0
for i in range(5,len(w)-4):
entry=ct.CTkEntry(window_3,height=35,width=300)
label=ct.CTkLabel(window_3,height=20,width=50,fon
t=('abc',20,'bold'),
text_color="white",text=w[i])
entry.place(x=180,y=300+p)
label.place(x=40,y=300+p)
p+=60
b=300+p
l.append(entry)
button3=ct.CTkButton(window_3,text='Submit',text_
color='black',command=save,font=('Comic
Sans',20,'bold'),hover_color='white')
button3.place(x=190,y=b)
window_3.mainloop()
def delete2():
l,deldata=[],[]
global a
global entry4
x=0
chk=False
with open(a,'r') as f:
Page | 13
read = csv.reader(f)
for i in read:
if x!=0:
if entry4.get() == i[2]:
print(i)
chk = True
x+=1
if chk ==False:
messagebox.showinfo(message='Student data
is not available')
else:
with open(a,'r') as f:
x=0
reader = csv.reader(f)
for i in reader:
if x!=0:
if i[2]!=entry4.get():
deldata.append(i)
else:
head=i
x+=1
with open(a,'w',newline='') as f:
csv_w=csv.writer(f,delimiter=',')
csv_w.writerow(head)
s=0
c=[]
for i in deldata:
l.append(int(i[3]))
l.sort(reverse=True)
print(l)
for i in l:
for j in deldata:
if i==int(j[3]):
if j not in c:
s+=1
j[0]=s
csv_w.writerow(j)
window4.destroy()
Page | 14
messagebox.showinfo(message='deleted
successfully')
def delete1():
global window4
window4=ct.CTk()
window3.destroy()
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
window4.geometry('250x250')
label=ct.CTkLabel(window4,font=('abc',20,'bold'),
text_color='white',text='Enter Roll no:')
label.place(x=60,y=70)
global entry4
entry4=ct.CTkEntry(window4,font=('abc',20,'bold')
,corner_radius=30)
entry4.place(x=60,y=120)
button4=ct.CTkButton(window4,font=('abv',10,'bold
'),width=70,text='submit',command=delete2)
button4.place(x=95,y=170)
window4.mainloop()
def search2():
x=0
chk=False
global a
with open(a,'r') as f:
read = csv.reader(f)
for i in read:
if x!=0:
if entry4.get() == i[2]:
chk = True
x+=1
if chk ==False:
messagebox.showinfo(message='Student data
is not available')
Page | 15
else:
window=ct.CTk()
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
window.geometry('620x620')
with open(a,'r') as f2:
read = csv.reader(f2)
chk2=True
for i in read:
if chk2==True:
w=i
chk2=False
if entry4.get() == i[2]:
print(i)
main_label=ct.CTkLabel(window,text="STUDENT
DETAILS",font=('abc',35,'italic'), tex
t_color='light green')
main_label.place(x=140,y=19)
nm_label=ct.CTkLabel(window,text="NAME:-",font=('
abc',20,'bold'))
nm1_label=ct.CTkLabel(window,text=i[1],font=('abc
',20,'bold'),height=30,
width=70,fg_color='light
blue',text_color='black',
corner_radius=30)
nm_label.place(x=50,y=140)
nm1_label.place(x=200,y=140)
rank_label=ct.CTkLabel(window,text="RANK:-",font=
('abc',20,'bold'))
rank1_label=ct.CTkLabel(window,text=i[0],font=('a
Page | 16
bc',20,'bold'),height=30,width=70,fg_color='light
blue',text_color='black',corner_radius=30)
rank_label.place(x=50,y=80)
rank1_label.place(x=200,y=80)
roll_label=ct.CTkLabel(window,text="ROLL
NO:-",font=('abc',20,'bold'))
roll1_label=ct.CTkLabel(window,text=i[2],font=('a
bc',20,'bold'),height=30,
width=70,fg_color='light
blue',text_color='black',corner_radius=30)
roll_label.place(x=50,y=200)
roll1_label.place(x=200,y=200)
total_label=ct.CTkLabel(window,text="TOTAL:-",fon
t=('abc',20,'bold'))
total1_label=ct.CTkLabel(window,text=i[3],font=('
abc',20,'bold'),height=30,width=70,fg_color='ligh
t blue',text_color='black',
corner_radius=30)
total_label.place(x=50,y=260)
total1_label.place(x=200,y=260)
percent_label=ct.CTkLabel(window,text="PERCENT:-"
,font=('abc',20,'bold'))
percent1_label=ct.CTkLabel(window,text=i[4],font=
('abc',20,'bold'),height=30,width=70,fg_color='li
ght blue',text_color='black',
corner_radius=30)
Page | 17
percent_label.place(x=300,y=260)
percent1_label.place(x=450,y=260)
h=0
for j in range(5,len(i)-4):
sub_label=ct.CTkLabel(window,text=w[j].upper(),fo
nt=('abc',20,'bold'))
sub1_label=ct.CTkLabel(window,text=i[j],font=('ab
c',20,'bold'),height=30,width=70,fg_color='light
blue',text_color='black',corner_radius=30)
p=320+h
sub_label.place(x=50,y=320+h)
sub1_label.place(x=200,y=320+h)
h+=60
grade_label=ct.CTkLabel(window,text="GRADE:",font
=('abc',20,'bold'))
grade1_label=ct.CTkLabel(window,text=i[len(i)-
4],font=('abc',20,'bold'),height=30,width=70,fg_c
olor='light
blue',text_color='black',corner_radius=30)
grade_label.place(x=50,y=p+60)
grade1_label.place(x=200,y=p+60)
class_label=ct.CTkLabel(window,text="CLASS:-",fon
t=('abc',20,'bold'))
class1_label=ct.CTkLabel(window,text=i[len(i)-
Page | 18
3],font=('abc',20,'bold'),height=30,width=70,fg_c
olor='light
blue',text_color='black',corner_radius=30)
class_label.place(x=50,y=p+120)
class1_label.place(x=200,y=p+120)
div_label=ct.CTkLabel(window,text="DIVISION:-",fo
nt=('abc',20,'bold'))
div1_label=ct.CTkLabel(window,text=i[len(i)-
2],font=('abc',20,'bold'),height=30,width=70,fg_c
olor='light
blue',text_color='black',corner_radius=30)
div_label.place(x=300,y=p+120)
div1_label.place(x=450,y=p+120)
dob_label=ct.CTkLabel(window,text="DOB:-",font=('
abc',20,'bold'))
dob1_label=ct.CTkLabel(window,text=i[len(i)-
1],font=('abc',20,'bold'),height=30,width=70,fg_c
olor='light
blue',text_color='black',corner_radius=30)
dob_label.place(x=50,y=p+180)
dob1_label.place(x=200,y=p+180)
window4.destroy()
window.mainloop()
def search():
global window4
window4=ct.CTk()
Page | 19
window3.destroy()
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
window4.geometry('250x250')
label=ct.CTkLabel(window4,font=('abc',20,'bold'),
text_color='white',text='Enter Roll no:')
label.place(x=60,y=70)
global entry4
entry4=ct.CTkEntry(window4,font=('abc',20,'bold')
,corner_radius=30)
entry4.place(x=60,y=120)
button4ct.CTkButton(window4,font=('abv',10,'b
old'),width=70,text=
'submit',command=search2)
button4.place(x=95,y=170)
window4.mainloop()
def modify2():
x=0
chk=False
global a
with open(a,'r') as f:
read = csv.reader(f)
for i in read:
if x!=0:
if entry4.get() == i[2]:
chk = True
x+=1
if chk ==False:
messagebox.showinfo(message='Student data
is not available')
else:
x=0
window=ct.CTk()
Page | 20
window.geometry('700x600')
data=[]
with open(a,'r') as f2:
read = csv.reader(f2)
for i in read:
if entry4.get()==i[2]:
mod_data=i
else:
data.append(i)
g=entry4.get()
window5.destroy()
nm_label=ct.CTkLabel(window,text="NAME:-",font=('
abc',20,'bold'))
nm1_label=ct.CTkLabel(window,text=mod_data[1],fon
t=('abc',20,'bold'),height=30,width=70,fg_color='
light blue',text_color='black',corner_radius=30)
nm_label.place(x=40,y=80)
nm1_label.place(x=160,y=80)
roll_label=ct.CTkLabel(window,text="ROLL
NO:-",font=('abc',20,'bold'))
roll1_label=ct.CTkLabel(window,text=mod_data[2],f
ont=('abc',20,'bold'),height=30,
width=70,fg_color='light
blue',text_color='black',
corner_radius=30)
roll_label.place(x=300,y=80)
roll1_label.place(x=440,y=80)
label3=ct.CTkLabel(window,text='CLASS:-',font=('C
alibri',20,'bold'))
Page | 21
label4=ct.CTkLabel(window,text='DIVISION:-',font=
('Calibri',20,'bold'))
doblabel=ct.CTkLabel(window,text='DOB:-',font=('C
alliber',20,'bold'))
label3.place(x=40,y=170)
label4.place(x=360,y=175)
doblabel.place(x=40,y=230)
div1=['A','B','C','D']
div=ct.CTkComboBox(window,
values=div1)
class1=['X','XII']
clas=ct.CTkComboBox(window,
values=class1)
print(mod_data)
clas.set(mod_data[len(mod_data)-3])
div.set(mod_data[len(mod_data)-2])
clas.place(x=180,y=175)
dayval
=['1','2','3','4','5','6','7','8','9','10','11','
12','13','14','15','16','17','18','19','20','21',
'22','23','24','25','26','27','28','29','30','31'
]
monthval=['Jan','Feb','Mar','April','May','Jun','
Jul','Aug','Sep','Oct','Nov','Dec']
yearval =
['2004','2005','2006','2007','2008','2009']
div.place(x=515,y=175)
day =
ct.CTkComboBox(window,values=dayval)
month =
ct.CTkComboBox(window,values=monthval)
Page | 22
year =
ct.CTkComboBox(window,values=yearval)
day.set(mod_data[len(mod_data)-1][0:2])
day.place(x=140,y=230)
month.place(x=290,y=230)
month.set(mod_data[len(mod_data)-1][-8:-
5:1])
year.set(mod_data[len(mod_data)-1][-4::])
year.place(x=440,y=230)
def save2():
b=0
stud_list1 =
[mod_data[0],mod_data[1],mod_data[2],mod_data[3],
mod_data[4]]
for idx,entry in enumerate(l):
b+=int(entry.get())
stud_list1[3]=b
stud_list1[4]=b/((len(mod_data)-
4)-5)
stud_list1.append(entry.get())
if stud_list1[4] >= 90:
stud_list1.append('A1')
elif stud_list1[4]>= 80:
stud_list1.append('A2')
elif stud_list1[4] >= 70:
stud_list1.append('B1')
elif stud_list1[4] >= 60:
stud_list1.append('B2')
elif stud_list1[4] >= 50:
stud_list1.append('C1')
elif stud_list1[4] < 50:
stud_list1.append('C2')
stud_list1.append(clas.get())
stud_list1.append(div.get())
Page | 23
stud_list1.append(day.get()
+'/'+month.get()+'/'+year.get())
print(stud_list1)
global a
with open(a,'r') as f4:
read=csv.reader(f4)
data,mrk=[],[]
k=0
for i in read:
print(i)
if k==0:
field=i
elif g!=i[2]:
data.append(i)
mrk.append(int(i[3]))
else:
data.append(stud_list1)
mrk.append(stud_list1[3])
k+=1
mrk.sort(reverse=True)
print(mrk)
print(data)
with open(a,'w',newline='') as
f5:
p,f=0,0
write=csv.writer(f5,delimiter=',')
write.writerow(field)
o=[]
for i in mrk:
for j in data:
if j not in o:
if i==int(j[3]):
p+=1
j[0]=p
write.writerow(j)
Page | 24
o.append(j)
messagebox.showinfo(message='updated
successfully')
window.destroy()
l=[]
p,b=0,0
for i in range(5,len(mod_data)-4):
entry=ct.CTkEntry(window,height=35,width=300)
entry.insert(0,mod_data[i])
label=ct.CTkLabel(window,height=20,width=50,font=
('abc',20,'bold'),text_color="white",text=data[0]
[i].upper())
entry.place(x=180,y=300+p)
label.place(x=40,y=300+p)
p+=60
b=300+p
l.append(entry)
button=ct.CTkButton(window,text='Submit',text_col
or='black',command=save2,font=('Comic
Sans',20,'bold'),hover_color='white')
button.place(x=190,y=b)
window.mainloop()
def modify():
global window5
window3.destroy()
window5=ct.CTk()
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
window5.geometry('250x250')
Page | 25
label=ct.CTkLabel(window5,font=('abc',20,'bold'),
text_color='white',text='Enter Roll no:')
label.place(x=60,y=70)
global entry4
entry4=ct.CTkEntry(window5,font=('abc',20,'bold')
,corner_radius=30)
entry4.place(x=60,y=120)
button4=ct.CTkButton(window5,font=('abv',10,'bold
'),width=70,
text='submit',command=modify2)
button4.place(x=95,y=170)
window5.mainloop()
def options():
global a
a=entry3.get()
try:
with open(a,'r') as f:
global window3
window3=ct.CTk()
window2.destroy()
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
window3.geometry('250x250')
button1=ct.CTkButton(window3,font=('abv',10,'bold
'),width=100,text='ADD',command=add)
button1.place(x=70,y=50)
button2=ct.CTkButton(window3,font=('abv',10,'bold
'),width=100,text='DELETE',command=delete1)
button2.place(x=70,y=90)
Page | 26
button3=ct.CTkButton(window3,font=('abv',10,'bold
'),width=100,text='UPDATE',command=modify)
button3.place(x=70,y=130)
button=ct.CTkButton(window3,font=('abv',10,'bold'
),width=100,text='SEARCH',command=search)
button.place(x=70,y=170)
window3.mainloop()
except:
messagebox.showerror(message='File not
found',title='Error')
def file_name():
global window2
window2=ct.CTk()
window.destroy()
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
window2.geometry('250x250')
label=ct.CTkLabel(window2,font=('abc',20,'bold'),
text_color='white',text='Enter file name')
label.place(x=60,y=70)
global entry3
entry3=ct.CTkEntry(window2,font=('abc',20,'bold')
,corner_radius=30)
entry3.place(x=60,y=120)
button=ct.CTkButton(window2,font=('abv',10,'bold'
),width=70,
text='submit',command=options)
button.place(x=95,y=170)
window2.mainloop()
Page | 27
window=ct.CTk()
window.geometry('500x500')
window.title('Primary Details')
window.resizable(height=False,width=False)
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
label1=ct.CTkLabel(window,text='Enter No: of
Students',font=('Calliber',20,'bold'))
label2=ct.CTkLabel(window,text='Enter No: of
Subjects',font=('Calliber',20,'bold'))
label1.place(x=150,y=50)
label2.place(x=150,y=200)
entry1=ct.CTkEntry(window,font=('Calliber',30,'bo
ld'),corner_radius=30,height=30,width=220,text_co
lor='black',fg_color='white',
border_color='red')
entry1.place(x=137,y=105)
entry2=ct.CTkEntry(window,font=('Calliber',30,'bo
ld'),corner_radius=30,height=30,width=220,text_co
lor='black',fg_color='white',
border_color='red')
entry2.place(x=137,y=255)
button=ct.CTkButton(window,text='Submit',command=
Submit,font=('Comic
Sans',20,'bold'),text_color='white',corner_radius
=30,height=30,width=110,fg_color='blue',border_co
lor='red')
button.place(x=110,y=330)
delete=ct.CTkButton(window,text='Delete',command=
delt,font=('Comic
Sans',20,'bold'),text_color='white',corner_radius
=30,height=30,width=110,fg_color='blue',border_co
lor='red')
delete.place(x=265,y=330)
use=ct.CTkButton(window,text='Use a
file',font=('Comic Sans',30,'bold'),
Page | 28
text_color='white',corner_radius=30,height=30,wid
th=110,fg_color='blue',
border_color='red',command=file_name)
use.place(x=163,y=400)
window.mainloop()
FILE 2:-
import customtkinter as ct
import tkinter as tk
import firstwindow as fw
no_students = fw.no_students
no_subjects= fw.no_subjects
a=''
ct.set_appearance_mode('dark')
ct.set_default_color_theme('green')
sub_list=[]
window = ct.CTk()
window.geometry('400x400')
window.resizable(width=False,height=False)
x=0
a='Subjects Saved:-'
def button_event():
global x,a
x+=1
sub_list.append(entry.get())
a+='\n'+str(x)+'.'+entry.get()
entry.delete(0,'end')
label2.configure(text=a)
if x==no_subjects:
button2.configure(fg_color='blue',state='active')
Page | 29
button1.configure(fg_color='gray',state='disabled
')
print(sub_list)
def dest():
window.destroy()
entry =
ct.CTkEntry(window,height=50,width=275,fg_color=(
'light blue'),
border_color='red',text_color='black',font=('abc'
,30,'bold'),corner_radius=40)
entry.place(x=65,y=100)
label1 = ct.CTkLabel(window,text="ENTER
SUBJECTS",font=('abc',30,'bold'))
label1.place(x=67,y=30)
label2 =
ct.CTkLabel(window,height=120,width=150,anchor="n
",
corner_radius=30,text=a,font=('abc',15,'bold'),f
g_color='white',text_color='black')
label2.place(x=115,y=250)
button1 =
ct.CTkButton(window,height=25,width=75,font=('abc
',17,'bold'),
text="Submit",fg_color='blue',corner_radius=20,
state="active",command=button_event
)
button1.place(x=115,y=170)
button2 =
ct.CTkButton(window,text='Next',height=25,width=7
5,corner_radius=20,font=('abc',17,'bold'),
Page | 30
fg_color='gray',state='disabled',command=dest)
button2.place(x=220,y=170)
window.mainloop()
from tkinter import messagebox
import secondwindow as sw
import csv
import customtkinter as ct
global sub_list
no_sub=sw.sub_list
x=0
stud_list1,stud_list2,prim_details = [],[],[]
def file_save():
global record
record=prim_details
subs = no_sub
global field
field=['rank','Name','Rollno','Total','Percentage
']+subs+['Grade','Class','Division','DOB']
def save():
global record
global field
l,rank=[],[]
with open(entry.get()
+'.csv','w',newline='') as f:
csv_w=csv.writer(f,delimiter=',')
csv_w.writerow(field)
a=0
for i in record:
l.append(i[2])
l.sort(reverse=True)
print(l)
for i in l:
for j in record:
if i==j[2]:
Page | 31
a+=1
j.insert(0,a)
csv_w.writerow(j)
window.destroy()
window=ct.CTk()
ct.set_appearance_mode('dark')
ct.set_default_color_theme('blue')
window.geometry('250x250')
label=ct.CTkLabel(window,font=('abc',20,'bold'),t
ext_color='white',text='Enter file name')
label.place(x=60,y=70)
entry=ct.CTkEntry(window,font=('abc',20,'bold'),c
orner_radius=30)
entry.place(x=60,y=120)
button=ct.CTkButton(window,font=('abv',10,'bold')
,width=70,text='submit',
command=save)
button.place(x=95,y=170)
window.mainloop()
def save():
total,avg=0,0
global x
x+=1
if not name.get().isnumeric() and
cb_rollno.get().isnumeric():
stud_list1 =
[name.get(),cb_rollno.get(),total,avg]
for idx,entry in enumerate(l):
if entry.get().isnumeric():
a=int(entry.get())
stud_list1[2]+=a
stud_list1.append(entry.get())
print(total)
Page | 32
entry.delete(0,'end')
else:
messagebox.showinfo(message="Only
numbers are allowed")
stud_list1[3]=stud_list1[2]/sw.no_subjects
else:
messagebox.showinfo(message='Inappropriate
characters are entered')
name.delete(0,'end')
cb_rollno.delete(0,'end')
if stud_list1[2]/sw.no_subjects >= 90:
stud_list1.append('A1')
elif stud_list1[2]/sw.no_subjects >= 80:
stud_list1.append('A2')
elif stud_list1[2]/sw.no_subjects >= 70:
stud_list1.append('B1')
elif stud_list1[2]/sw.no_subjects >= 60:
stud_list1.append('B2')
elif stud_list1[2]/sw.no_subjects >= 50:
stud_list1.append('C1')
elif stud_list1[2]/sw.no_subjects < 50:
stud_list1.append('C2')
stud_list2.append(stud_list1)
print(stud_list2)
stud_list1.append(clas.get())
stud_list1.append(div.get())
stud_list1.append(day.get()+'/'+month.get()
+'/'+year.get())
prim_details.append(stud_list1)
print(prim_details)
if x== sw.no_students:
window_3.destroy()
Page | 33
file_save()
window_3=ct.CTk()
ct.set_appearance_mode('dark')
window4=ct.CTk()
window_3.geometry('700x700')
window_3.title('Students Details')
window_3.resizable(height=False,width=False)
doblabel=ct.CTkLabel(window_3,text='DOB:-',font=(
'Calliber',20,'bold'))
label1=ct.CTkLabel(window_3,text='Name :-',font=(
'Calliber',20,'bold'))
label2=ct.CTkLabel(window_3,text='RollNo:-',font=
('Calliber',20,'bold'))
label3=ct.CTkLabel(window_3,text='Class:-',font=(
'Calliber',20,'bold'))
label4=ct.CTkLabel(window_3,text='Division:-',fon
t=('Calliber',20,'bold'))
label1.place(x=40,y=50)
label2.place(x=40,y=110)
label3.place(x=40,y=170)
label4.place(x=360,y=175)
doblabel.place(x=40,y=230)
name=ct.CTkEntry(window_3,height=20,width=300,fon
t=('Calliber',20,'bold'),fg_color='light
blue',border_color='red',
text_color='black')
name.place(x=180,y=50)
cb_rollno=ct.CTkEntry(window_3,font=('Calliber',2
0,'bold'),fg_color='light
blue',border_color='red',text_color='black',heigh
t=20,width=300)
cb_rollno.place(x=180,y=110)
div1=['A','B','C','D']
div=ct.CTkComboBox(window_3,
values=div1)
class1=['X','XII']
Page | 34
clas=ct.CTkComboBox(window_3,
values=class1)
clas.place(x=180,y=175)
dayval=['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20'
,'21','22','23','24','25','26','27','28','29','30
','31']
monthval=['Jan','Feb','Mar','April','May','Jun','
Jul','Aug','Sep','Oct','Nov','Dec']
yearval =
['2004','2005','2006','2007','2008','2009']
div.place(x=515,y=175)
day = ct.CTkComboBox(window_3,values=dayval)
month = ct.CTkComboBox(window_3,values=monthval)
year = ct.CTkComboBox(window_3,values=yearval)
day.place(x=140,y=230)
month.place(x=290,y=230)
year.place(x=440,y=230)
l=[]
p,b=0,0
for i in range(sw.no_subjects):
entry=ct.CTkEntry(window_3,height=35,width=300)
label=ct.CTkLabel(window_3,height=20,width=50,fon
t=('abc',20,'bold'),
text_color="white",text=sw.sub_list[i])
entry.place(x=180,y=300+p)
label.place(x=40,y=300+p)
p+=60
b=300+p
l.append(entry)
Page | 35
button3=ct.CTkButton(window_3,text='Submit',text_
color='black',command=save,
font=('Comic
Sans',20,'bold'),hover_color='white')
button3.place(x=190,y=b)
window_3.mainloop()
Page | 36
OUTPUTS
1) CREATING A RANKLIST
Enter the student details as per the
No: of students entered
Page | 37
File manipulation Options(after creation of file )
These 3 windows are primary and mandatory for every file
manipulation. 1st window and 2nd window is for choosing the
file and 3rd window is for choosing the manipulation option.
Page | 38
1)Adding a student record
Page | 39
2)Deleting a record
3)Updating a record
Page | 40
Page | 41
4) Search a record
Page | 42
Page | 43
BIBLIOGRAPHY
1) https://
www.geeksforgeeks.org/
2) https://stackoverflow.com/
3) https://github.com/
4) https://
www.w3schools.com/
Page | 44