Compprorep
Compprorep
Project Report
On Bank
Management
FOR AISSCE 2025 EXAMINATION
[AS A PART OF THE COMPUTER SCIENCE COURSE (083)]
Page 1 of 33
CERTIFICATE
………………………… ……………………………..
Signature of Principal Signature of Teacher
………………………… ……………………………..
Signature of Examiner Signature of Student
Page 2 of 33
ACKNOWLEDGEMENT
Page 3 of 33
Table of Contents
CERTIFICATE..........................................................2
ACKNOWLEDGEMENT..........................................3
INTRODUCTION...................................................5
OBJECTIVE AND PROJECT DEFINITION................6
HARDWARE AND SOFTWARE REQUIREMENTS..7
MODULES.............................................................8
Tkinter......................................................8
Pillow........................................................8
MYSQL Connector....................................9
Code and Output..................................................9
Database Description...............................9
Project code files.....................................10
Text files for question bank......................10
MainGame.py............................................11
NewUser.py...............................................13
LoginGame.py............................................16
Quizgame.py..............................................19
ShowScore.py.............................................27
deleteUser.py.............................................30
BIBLOGRAPHY........................................................33
Page 4 of 33
INTRODUCTION
BANK
MANAGEM
ENT:
Games are essential for development of the
students. It nurtures the competitive sprit in
students. This quiz game will enhance the
knowledge of the students on different subject.
Page 5 of 33
OBJECTIVE AND PROJECT
DEFINITION
Page 6 of 33
HARDWARE AND SOFTWARE
REQUIREMENTS
1. PC with Intel core i5 with 64 GB RAM and 64
bit OS
2. MS Windows 11 OS
3. Python 5.5
4. IDLE (Python 5.5)
5. Python Libraries
a. TKinter
b. Pillow
c. MySQL Connector
6. MySQL DB
Page 7 of 33
MODULES
Tkinter
Tkinter is a useful tool for creating a wide
variety of graphical user interfaces, including
windows, dialog boxes, and custom widgets. It
is particularly well-suited for building desktop
applications and adding a GUI to command-line
programs. It is indeed one of the fastest and
easiest ways to build GUI applications.
Moreover, Tkinter is cross-platform, hence the
same code works on macOS, Windows, and
Linux.
To install Tkinter: pip install Tk
Pillow
The Pillow library in Python contains all the
basic image processing functionality. We can
rotate, resize and transform an image. In this
code, the Pillow module has been used in
defining the backgrounds
that appear as the output.
To install Pillow: pip install pillow
Page 8 of 33
MYSQL Connector
MySQL Connector/Python enables Python
programs to access MySQL databases, using an
API that is compliant with the python.
Tables:
Page 9 of 33
Project code files:
S.no. File Name Description
1 MainGame.p Main window of the project gives user all the
y options provided by the
application
2 NewUser.py This window of the application allow user to add
new user
3 LoginGame.p This window allows user to login to play the quiz
y
4 Quizgame.py This is the window to show the questions and
receive the answers
5 ShowScore.p After the quiz it shows the score
y
6 deleteUser.p To delete a user from DB only Admin can delete
y the user
Page 10 of 33
MainGame.py:
from randommport rand nt
from tknter mport
messagebox from tknter
mport *
mport tk nter as
tk mport os
from flIL mport ImageTk,
Image from Log nGame mport
*
from NewUser mport *
from deleteUser mport *
Page 11 of 33
Output:
Page 12 of 33
NewUser.py:
from random mport rand nt
from tk nter mport messagebox
from tk nter mport *
mport tk nter as tk
mport os
from flIL mport ImageTk, Image
mport mysql.connector
nu_pwd=None
nu_UName=None
nu_UID=None
def newu():
global Ma n_w ndow, Canvas1, nu_UName, nu_pwd,nu_UID
Ma n_w ndow = Tk()
Ma n_w ndow.t tle("Ǫu zGame New User")
Ma n_w ndow.m ns ze(w dth=400,he ght=400)
Ma n_w ndow.geometry("600x500")
nu_UID = Entry(labelFrame)
nu_UID.place(relx=0.3,rely=0.2, relw dth=0.62, relhe ght=0.08)
nu_UName = Entry(labelFrame)
nu_UName.place(relx=0.3,rely=0.35, relw dth=0.62, relhe ght=0.08)
Page 13 of 33
lb3 = Label(labelFrame,text="flassword : ", bg='black', fg='wh te')
lb3.place(relx=0.05,rely=0.5, relhe ght=0.08)
nu_pwd = Entry(labelFrame)
nu_pwd.place(relx=0.3,rely=0.5, relw dth=0.62, relhe ght=0.08)
Subm t Button
Subm tBtn = Button(Ma n_w ndow,text="Add User",bg=' d1ccc0',
fg='black',command=adduser)
Subm tBtn.place(relx=0.28,rely=0.9, relw dth=0.18,relhe ght=0.08)
qu tBtn = Button(Ma n_w ndow,text="Ǫu t",bg=' f7f1e3', fg='black',
command=Ma n_w ndow.destroy)
qu tBtn.place(relx=0.53,rely=0.9, relw dth=0.18,relhe ght=0.08)
con=mysql.connector.connect(host="localhost",user="root",password="T aa123$"
,database="qu zgame")
cur = con.cursor()
suname = nu_UName.get()
spwd = nu_pwd.get()
su d = nu_UID.get()
values="('"+su d+"' ,'"+suname+"' ,'"+spwd+"')"
pr nt(values)
userTable = "gameplayer"
extractInfo="select * from {} where d='{}'".format(userTable,su d)
pr nt (extractInfo)
try:
cur.execute(extractInfo)
data =cur.fetchall()
Count=cur.rowcount
pr nt (data)
pr nt("rowCount=",Count)
f Count>0:
messagebox.show nfo("Error","User already ex st!")
Ma n_w ndow.destroy()
else:
extractInfo1=" nsert nto {} value {}".format(userTable,values)
cur.execute(extractInfo1)
con.comm t()
messagebox.show nfo("Success", "User Added successfully")
Ma n_w ndow.destroy()
Page 14 of 33
except:
messagebox.show nfo("Error", "Can't get the gameplayer data") Ma n_w ndow.destroy()
Output:
Page 15 of 33
LoginGame.py:
from random mport rand nt
from tk nter mport messagebox
from tk nter mport *
mport tk nter as tk
mport os
from flIL mport ImageTk, Image
mport mysql.connector
from Ǫu zgame mport *
txpwd=None
UName=None
con=mysql.connector.connect(host="localhost",user="root",password="Abc",dat
abase="db")
cur = con.cursor()
Enter Table Names here
UName = Entry(labelFrame)
Page 16 of 33
UName.place(relx=0.3,rely=0.2, relw dth=0.62, relhe ght=0.08)
txpwd = Entry(labelFrame)
txpwd.place(relx=0.3,rely=0.35, relw dth=0.62, relhe ght=0.08)
Subm t Button
Subm tBtn = Button(Ma n_w ndow,text="SUBMIT",bg=' d1ccc0',
fg='black',command=glog n)
Subm tBtn.place(relx=0.28,rely=0.9, relw dth=0.18,relhe ght=0.08)
qu tBtn = Button(Ma n_w ndow,text="Ǫu t",bg=' f7f1e3', fg='black',
command=Ma n_w ndow.destroy)
qu tBtn.place(relx=0.53,rely=0.9, relw dth=0.18,relhe ght=0.08)
con=mysql.connector.connect(host="localhost",user="root",password="T aa123$"
,database="qu zgame")
cur = con.cursor()
userTable = "gameplayer"
extractInfo="select * from {} where d='{}'".format(userTable,suname)
try:
cur.execute(extractInfo)
data =cur.fetchall()
pr nt (data)
f data[0][0]==suname:
f data[0][2]==spwd:
Ma n_w ndow.destroy()
play(suname)
else:
messagebox.show nfo("Error", "Username or password not
val d")
Ma n_w ndow.destroy()
else:
messagebox.show nfo("Error", "Username or password not val d")
Ma n_w ndow.destroy()
Page 17 of 33
except:
messagebox.show nfo("Error", "Can't get the gameplayer data") Ma n_w ndow.destroy()
Output
Page 18 of 33
Quizgame.py:
from random mport rand nt
from tk nter mport messagebox
from tk nter mport *
mport tk nter as tk
mport os
from flIL mport ImageTk, Image
mport mysql.connector
from ShowScore mport *
quest onsGK=[]
AnswersGK=[]
quest onsMath=[]
AnswersMath=[]
quest onsS c=[]
AnswersS c=[]
quest onsComp=[]
AnswersComp=[]
qL st=[]
ansL st=[]
qvar1=None
quest on=""
f rst=0
count=0
score=0
Sk pcount=0
ans=""
my_label=None
qlableText=None
qlb1=None
head ngFrame1=None
head ngLabel=None
qlabelFrame=None
uname=""
subject=""
creat ng the tk nter w ndow
Page 110 of
33
wh le True:
count += 1
Get next l ne from f le
l ne = f le1.readl ne()
f l ne s empty
end of f le s reached
l ne = f le_ans.readl ne()
f not l ne:
break
pr nt(l ne);
al st=l ne.spl t(",")
pr nt(al st)
quest on_l st.append(l ne)
f le_ans.close()
pr nt(count)
return al st
Page 20 of 33
pr nt (" n showǪuest on")
f (count==5):
show result
text1="you score "+str(score)+ " outof 5"
messagebox.show nfo( "Result", text1)
addscoretoDB()
ex t(0)
else:
pr nt(" ns de else count=",count)
qno=rand nt(0,9-count)
pr nt(" ns de else qno=",qno)
count=count+1
q=qL st.pop(qno)
tokens=q.spl t("|")
qu=tokens[0]+"\n"+tokens[1]+"\n"+tokens[2]+"\n"+tokens[3]+"\n"+tokens[4]
qlableText.set(qu)
pr nt(ansL st)
ans=ansL st.pop(qno)
def addscoretoDB():
global uname,subject,score
pr nt ("user=",uname,"sub=" ,subject,"score=",score)
con=mysql.connector.connect(host="localhost",user="root",password="T aa123$"
,database="qu zgame")
cur = con.cursor()
userTable = "scores"
values="('"+uname+"',"+score+",'"+subject+"')"
extractInfo1=" nsert nto {} value
('{}',{},'{}')".format(userTable,uname,score,subject)
cur.execute(extractInfo1)
con.comm t()
ShowScoreScreen(uname,subject)
Page 21 of 33
global
subject,f rst,qvar1,qL st,quest onsGK,quest onsMath,quest onsS c,quest onsCo
mp,AnswersGK,AnswersMath,AnswersS c,AnswersComp,ansL st
pr nt("qvar1.get()=",qvar1.get())
f(f rst==0):
messagebox.show nfo( "subm t", str(qvar1.get()))
f rst=1
f(str(qvar1.get())=="1"):
pr nt("GK")
subject="GK"
mportqu z('Ǫuest ons\GK_ques.txt',quest onsGK)
AnswersGK= mportans('Ǫuest ons\GK_ans.txt',AnswersGK)
pr nt(AnswersGK)
qL st=quest onsGK
ansL st=AnswersGK
el f(str(qvar1.get())=="2"):
pr nt("math")
subject="Math"
mportqu z('Ǫuest ons\Math_ques.txt',quest onsMath)
AnswersMath= mportans('Ǫuest ons\Math_ans.txt',AnswersMath)
qL st=quest onsMath
ansL st=AnswersMath
el f(str(qvar1.get())=="3"):
pr nt("sc ence")
subject="Sc ence"
mportqu z('Ǫuest ons\Sc _ques.txt',quest onsS c)
AnswersS c= mportans('Ǫuest ons\Sc _ans.txt',AnswersS c)
qL st=quest onsS c
ansL st=AnswersS c
el f(str(qvar1.get())=="4"):
pr nt("Comp sc ence")
subject="Computer"
mportqu z('Ǫuest ons\Comp_ques.txt',quest onsComp)
AnswersComp= mportans('Ǫuest ons\Comp_ans.txt',AnswersComp)
qL st=quest onsComp
ansL st=AnswersComp
showǪuest on()
else:
addscoretoDB()
qMa n_w ndow.destroy()
def nextCallBack():
global f rst, qL st, ansL st,var,qlableText
ver fyAns()
showǪuest on()
Page 22 of 33
def sk pCallBack():
global Sk pcount
f(Sk pcount==1):
messagebox.show nfo ("Sk p","You already sk ped 1 quest on, \ncannot
sk p th s one")
else:
Sk pcount=Sk pcount+1
showǪuest on()
def sel():
messagebox.show nfo("sel",var.get())
a=2
def play(user):
global qMa n_w ndow, qvar1,qlableText,qlb1,qlabelFrame,uname
qMa n_w ndow = Tk()
qMa n_w ndow.t tle("Ǫu z Game")
qMa n_w ndow.m ns ze(w dth=400,he ght=400)
qMa n_w ndow.geometry("600x500")
uname=user
qCanvas1 = Canvas(qMa n_w ndow)
qCanvas1.conf g(bg=" B22222")
qCanvas1.pack(expand=True,f ll=BOTH)
qlableText=tk.Str ngVar()
qlb1 = Label(qlabelFrame, textvar able=qlableText, bg='black',
fg='wh te',font=('Century 12'),just fy=LEFT,wraplength=450)
qlableText.set("Select The Ǫu z subject from below opt ons\n\nA) GK\nB)
Math\nC) Sc ence\nD) flython ")
qlb1.place(relx=0.05,rely=0.02, relw dth=0.9,relhe ght=0.5)
qvar1 = IntVar()
R1 = Rad obutton(qlabelFrame, text="A", var able=qvar1, value=1,
fg='black',bg='wh te',command=sel).place(relx=.1,rely=.55)
Page 23 of 33
R2 = Rad obutton(qlabelFrame, text="B", var able=qvar1, value=2,
fg='black',bg='wh te',command=sel).place(relx=.5,rely=.55)
R3 = Rad obutton(qlabelFrame, text="C", var able=qvar1, value=3,
fg='black',bg='wh te',command=sel).place(relx=.1,rely=.7)
R4 = Rad obutton(qlabelFrame, text="D", var able=qvar1, value=4,
fg='black',bg='wh te',command=sel).place(relx=.5,rely=.7)
Subm t Button
nxtBtn = Button(qMa n_w ndow,text="Next",bg=' d1ccc0',
fg='black',command=nextCallBack)
nxtBtn.place(relx=0.2,rely=0.9, relw dth=0.18,relhe ght=0.08)
Subm tBtn = Button(qMa n_w ndow,text="SUBMIT",bg=' d1ccc0',
fg='black',command=subm tCallBack)
Subm tBtn.place(relx=0.4,rely=0.9, relw dth=0.18,relhe ght=0.08)
qu tBtn = Button(qMa n_w ndow,text="Ǫu t",bg=' f7f1e3', fg='black',
command=qMa n_w ndow.destroy)
qu tBtn.place(relx=0.6,rely=0.9, relw dth=0.18,relhe ght=0.08)
Page 24 of 33
Output:
Page 25 of 33
Page 26 of 33
ShowScore.py:
from random mport rand nt
from tk nter mport messagebox
from tk nter mport *
mport tk nter as tk
mport os
from flIL mport ImageTk, Image
mport mysql.connector
from Ǫu zgame mport *
uname=''
subject=''
def ShowScoreScreen(user,sub):
global Ma n_w ndow, Canvas1,uname,subject
Ma n_w ndow = Tk()
Ma n_w ndow.t tle("Ǫu zGame Score")
Ma n_w ndow.m ns ze(w dth=400,he ght=400)
Ma n_w ndow.geometry("600x500")
uname=user
subject=sub
Canvas1 = Canvas(Ma n_w ndow)
Canvas1.conf g(bg=" ff6e40")
Canvas1.conf g(bg=" FFFACD")
Canvas1.pack(expand=True,f ll=BOTH)
Label(labelFrame,text="%-20s%-10s%- 20s"%
('ID','Score','Subject'),bg='black',fg='wh te').place(relx=0.07,rely=0. 1)
Label(labelFrame,text="
-",bg='black',fg='wh te').place(relx=0.07,rely=0.2)
con=mysql.connector.connect(host="localhost",user="root",password="T aa123$"
,database="qu zgame")
cur = con.cursor()
userTable = "scores"
Page 27 of 33
extractInfo="select * from {} where ID='{}' and
subject='{}'".format(userTable,uname,subject)
pr nt (extractInfo)
y=0.3
try:
cur.execute(extractInfo)
data =cur.fetchall()
messagebox ("Score",data)
pr nt(data)
for n data:
Label(labelFrame,text="%-20s%-10s%-
20s"%( [0], [1], [2]),bg='black',fg='wh te').place(relx=0.07,rely=y)
y=y+0.1
except:
messagebox.show nfo("Error", "Can't get the gameplayer data")
ex tBTN= Button(Ma n_w ndow,text="Ex t",bg=' f7f1e3', fg='black',
command=Ma n_w ndow.destroy)
ex tBTN.place(relx=0.4,rely=0.9,relw dth=0.18,relhe ght=0.18)
Ma n_w ndow.ma nloop()
Page 28 of 33
Output:
Page 29 of 33
deleteUser.py:
from random mport rand nt
from tk nter mport messagebox
from tk nter mport *
mport tk nter as tk
mport os
from flIL mport ImageTk, Image
mport mysql.connector
from Ǫu zgame mport *
tpwd=None
dUser = None
Page 30 of 33
lb2 = Label(labelFrame,text="Delete User : ", bg='black', fg='wh te')
lb2.place(relx=0.05,rely=0.35, relhe ght=0.08)
dUser = Entry(labelFrame)
dUser.place(relx=0.3,rely=0.35, relw dth=0.62, relhe ght=0.08)
Subm t Button
Subm tBtn = Button(Ma n_w ndow,text="SUBMIT",bg=' d1ccc0',
fg='black',command=alog n)
Subm tBtn.place(relx=0.28,rely=0.9, relw dth=0.18,relhe ght=0.08)
qu tBtn = Button(Ma n_w ndow,text="Ǫu t",bg=' f7f1e3', fg='black',
command=Ma n_w ndow.destroy)
qu tBtn.place(relx=0.53,rely=0.9, relw dth=0.18,relhe ght=0.08)
def deleteUser(delU):
con=mysql.connector.connect(host="localhost",user="root",password="T aa123$"
,database="qu zgame")
cur = con.cursor()
userTable = "scores"
extractInfo="delete from {} where d='{}'".format(userTable,delU)
extractInfo1="delete from {} where d='{}'".format ("gameplayer",delU)
pr nt(extractInfo)
try:
cur.execute(extractInfo)
cur.execute(extractInfo1)
con.comm t();
messagebox.show nfo("Success", "User Delete Successfully")
except:
messagebox.show nfo("Error", "Can't get the data from DB")
Ma n_w ndow.destroy()
con=mysql.connector.connect(host="localhost",user="root",password="T aa123$"
,database="qu zgame")
cur = con.cursor()
userTable =
"gameplayer"
extractInfo="select * from {} where
d='{}'".format(userTable,suname)
pr
nt(extractInfo)
try:
cur.execute(extractInf
o) data =cur.fetchall()
pr nt (data)
f data[0][0]==suname:
f data[0]
[2]==spwd:
deleteUser(del
U)
Ma n_w
ndow.destroy()
play()
else:
messagebox.show nfo("Error", "You should be adm n to
delete user")
Ma n_w ndow.destroy()
else:
messagebox.show nfo("Error", "You should be adm n to delete
Page 32 of 33
Output:
BIBLOGRAPHY
1. https://www.mysql.com
2. https://pypi.org/project/Pillow/
3. https://docs.python.org/3/library/tkinter.html
4. https://www.w3schools.com/python/
5. Computer Science with Python (Textbook for Class XII) –
Sumita Arora
Page 33 of 33