COMPUTER SCIENCE PROJECT FILE (Ayush)
COMPUTER SCIENCE PROJECT FILE (Ayush)
SCIENCE PROJECT
Acknowledgement
This report is an outcome of the contribution made by
some of the people. Therefore, its our sole responsibility
to acknowledge them. We all are greatly thankful to the
sincere efforts made by Mrs Ansara Banu , our computer
science teacher who took out their precious time and
made various arrangement for conduction of the classes .
We would also mention the outstanding support given
by our parents who paved the way for me to complete
this project and with all our team members support here
we are with the project.
Warm regards
CERTIFICATE
This is to certify that "AYUSH SINGH PANWAR"
Of Class 12 –E of DLF Public
School has successfully completed the
COMPUTER SCIENCE PROJECT FILE
"LIBRARY MANAGEMENT SYSTEM" for the
Session 2020-2021.
____________________________________ __________________________________
OUTPUT-
LOGIN.PY
#user can login
from tkinter import *
import datetime
import os
import library
from tkinter import messagebox
import sqlite3
con = sqlite3.Connection("userdatabase")
cur = con.cursor()
class top:
con = sqlite3.Connection("userdatabase")
cur = con.cursor()
def __init__(self,win):
self.prvfrm=None
if(self.prvfrm!=None):
self.prvfrm.destroy()
self.win=win
self.win.title("Library Management System")
self.win.geometry("1278x600")
self.win.iconbitmap('images\\logonte.ico')
self.win.configure(bg="white")
self.date_f=StringVar()
x=datetime.datetime.now()
y=x.strftime("%d")
z=x.strftime("%B")
a=x.strftime("%Y")
self.date_f.set("Date:-"+y+'-'+z+'-'+a)
#=======main-frame=======
self.main_frame=Frame(self.win,bd=0,relief=RIDGE,bg="red")
self.main_frame.place(x=0,y=0,width=1278,height=35)
self.main_frame1=Frame(self.win,bd=0,relief=RIDGE,bg="white")
self.main_frame1.place(x=0,y=40,width=1278,height=670)
#=======main-label=======
self.main_label=Label(self.main_frame,text="Library Management
System",font=("Times New Roman",20,"bold"),fg="white",bg="red")
self.main_label.pack()
#=======main-date=======
self.main_date=Label(self.main_frame,textvariable=self.date_f,font=("Ti
mes New Roman",12,"bold"),fg="white",bg="red")
self.main_date.place(x=1095,y=10)
#=======lms-image=======
self.lms_image=PhotoImage(file="images/library.png")
self.lms_label=Label(self.main_frame1,image=self.lms_image,bg="white")
self.lms_label.image=self.lms_image
self.lms_label.place(x=0,y=35)
#=======username-label=======
self.username_label=Label(self.main_frame1,text="Username:-",font=("T
imes New Roman",12,"bold"),fg="black",bg="white")
self.username_label.place(x=900,y=150)
#=======username-entry=======
self.username_entry=Entry(self.main_frame1,font=("Times New Roman",12))
self.username_entry.place(x=1000,y=150)
#=======password-label=======
self.password_label=Label(self.main_frame1,text="Password:-",font=("Times New
Roman",12,"bold"),fg="black",bg="white")
self.password_label.place(x=900,y=200)
#=======password-entry=======
self.password_entry=Entry(self.main_frame1,font=("Times New
Roman",12),fg="black",show="*")
self.password_entry.place(x=1000,y=200)
#=======login_button=======
self.login_button=Button(self.main_frame1,text="Login",font=(" Times New
Roman",12),bg="white",fg="red",command=lambda:self.login(self.main_f
rame1));
self.login_button.place(x=1050,y=250,width=50,height=30)
#===========to login or start register if user is not
found============
def login(self,prvfrm):
g = self.username_entry.get()
l = self.password_entry.get()
cur.execute("select * from useraccount where username=? and
password=?", (g, l))
tup = cur.fetchone()
try:
if len(g)!=0:
if len(l)!=0:
if len(tup)!=0:
win.destroy()
library.sa()
else:
messagebox.showinfo("fail", 'enter your password')
else:
messagebox.showinfo("fail", 'enter your username ')
except:
messagebox.showinfo("fail", 'user not found, if new user pls sign
up')
def register():
win.destroy()
os.startfile("regg.py")
self.login_button = Button(self.main_frame1, text="register",
font=("Times New Roman", 12), bg="white",
fg="red", command=register);
self.login_button.place(x=1120, y=250, width=50, height=30)
win=Tk()
ob=top(win)
win.mainloop()
OUTPUT-
REG.PY
#user can reg backend database will be created
from tkinter import *
from tkinter import ttk
import os
import datetime
import sqlite3
#for database we use this code
con=sqlite3.Connection("userdatabase")
cur=con.cursor()
cur.execute("create table if not exists useraccount(email
varchar(50),username varchar(20) PRIMARY KEY, dname varchar(20) NOT
NULL ,mob number(10) NOT NULL ,gender varchar(9) NOT
NULL ,password varchar(20) NOT NULL)")
#from PIL import ImageTk,Image
from tkinter import messagebox
class top:
def __init__(self,win):
#---------to make canvas--------
self.prvfrm = None
if (self.prvfrm != None):
self.prvfrm.destroy()
self.win = win
self.win.title("Library Management System") #for title
self.win.geometry("650x550") #fullscreen
self.win.iconbitmap('images\\logonte.ico') #for title bar image
self.win.configure(bg="white") #for canvase color
self.date_f = StringVar() #for date in title bar
x = datetime.datetime.now()
y = x.strftime("%d")
z = x.strftime("%B")
a = x.strftime("%Y")
self.main_frame = Frame(self.win, bd=0, relief=RIDGE, bg="red")
self.main_frame.place(x=0, y=0, width=650, height=35)
self.main_frame1 = Frame(self.win, bd=0, relief=RIDGE, bg="white")
self.main_frame1.place(x=0, y=40, width=650, height=670)
# =======main-label================
self.main_label = Label(self.main_frame, text="Library Management
System", font=("Times New Roman", 20, "bold"),
fg="white", bg="red")
self.main_label.pack()
#-------------to make entry box-----------------
self.date_f.set("Date:-" + y + '-' + z + '-' + a)
self.main_frame3 = Frame(self.win, bd=0, relief=RIDGE, bg="white")
self.main_frame3.place(x=0, y=40, width=478, height=670)
self.id_label = Label(self.main_frame3, text="username",
font=("Times New Roman", 12), fg="black",bg="white")
self.id_label.place(x=5, y=50)
self.id_entry = Entry(self.main_frame3, font=("Times New Roman",
12), fg="black", bg="white")
self.id_entry.place(x=110, y=50)
self.id_label = Label(self.main_frame3, text="username",
font=("Times New Roman", 12), fg="black",
bg="white")
self.id_label.place(x=5, y=50)
self.id_entry = Entry(self.main_frame3, font=("Times New Roman",
12), fg="black", bg="white")
self.id_entry.place(x=110, y=50)
self.name_label = Label(self.main_frame3, text="Name",
font=("Times New Roman", 12), fg="black", bg="white")
self.name_label.place(x=5, y=100)
self.name_entry = Entry(self.main_frame3, font=("Times New
Roman", 12), fg="black", bg="white")
self.name_entry.place(x=110, y=100)
self.email_label = Label(self.main_frame3, text="Email",
font=("Times New Roman", 12), fg="black", bg="white")
self.email_label.place(x=5, y=150)
self.email_entry = Entry(self.main_frame3, font=("Times New
Roman", 12), fg="black", bg="white")
self.email_entry.place(x=110, y=150)
self.mobile_label = Label(self.main_frame3, text="Mobile",
font=("Times New Roman", 12), fg="black", bg="white")
self.mobile_label.place(x=5, y=200)
self.mobile_entry = Entry(self.main_frame3, font=("Times New
Roman", 12), fg="black", bg="white")
self.mobile_entry.place(x=110, y=200)
self.password_label = Label(self.main_frame3, text="pasword",
font=("Times New Roman", 12), fg="black", bg="white")
self.password_label.place(x=5, y=300)
self.password_entry = Entry(self.main_frame3, font=("Times New
Roman", 12), fg="black", bg="white")
self.password_entry.place(x=110, y=300)
self.gender_label = Label(self.main_frame3, text="Gender",
font=("Times New Roman", 12), fg="black", bg="white")
self.gender_label.place(x=5, y=250)
self.gender_combo = ttk.Combobox(self.main_frame3,
values=["Male", "Female", "Other"],
font=("Times New Roman", 12))
self.gender_combo.place(x=110, y=250)
def insert():
#------registration on sqlite3 database----------------
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
reg = '^[a-z0-9]+[\._]?[a-z0-9]'
r=self.email_entry.get()
f=self.gender_combo.get()
t=self.mobile_entry.get()
g=self.id_entry.get()
l=self.password_entry.get()
yh = self.name_entry.get()
#--------to validate entry---------
if (len(r) == 0 or len(f) == 0 or len(t) == 0 or len(g) == 0 or len(l) == 0
or len(yh) == 0):
messagebox.showwarning('Validation Failed', "Fields can't be
empty")
if (re.search(regex,r)):
if t.isdigit() and len(t)==10:
if len(l)>=2:
if yh.isalpha():
a = r + g + yh + t + f + l
cur.execute("insert into useraccount values(?,?,?,?,?,?)",
(r, g, yh, t, f, l))
con.commit()
win.destroy()
messagebox.showinfo("Congratulation!!", 'registraion
susscefull')
os.startfile("Login.py")
else:
messagebox.showinfo("fail", 'use correct name')
else:
messagebox.showinfo("fail", 'use stronger password atleast
longer then 10')
else:
messagebox.showinfo("fail", 'use correct phone no.')
else:
messagebox.showinfo("fail", 'use correct email')
def clear():
r = self.email_entry
f = self.gender_combo
t = self.mobile_entry
g = self.id_entry
l = self.password_entry
yh=self.name_entry
yh.delete(0, 'end')
r.delete(0, 'end')
f.delete(0, 'end')
t.delete(0, 'end')
g.delete(0, 'end')
l.delete(0, 'end')
insert_button = Button(text="Insert", font=("Times New Roman",
12), fg="black",bg="white",command=insert)
insert_button.place(x=130, y=399, width=60, height=30)
reset_button = Button(self.main_frame3,
text="Reset",command=clear, font=("Times New Roman", 12),
fg="black", bg="white")
reset_button.place(x=230, y=359, width=60, height=30)
win=Tk()
ob=top(win)
win.mainloop()
OUTPUT
LIBRARY.PY
#this is library from here u can read or rent a book
from tkinter import *
import os
import book
import sqlite3
import datetime
import os
def sa():
t=Tk()
text=Label(text="library")
prvfrm = None
if (prvfrm != None):
prvfrm.destroy()
t.title("Library Management System")
t.geometry("1275x700")
t.iconbitmap('images\\logonte.ico')
t.configure(bg="white")
date_f = StringVar()
x = datetime.datetime.now()
y = x.strftime("%d")
z = x.strftime("%B")
a = x.strftime("%Y")
date_f.set("Date:-" + y + '-' + z + '-' + a)
# =======main-frame
main_frame = Frame(t, bd=0, relief=RIDGE, bg="red")
main_frame.place(x=0, y=0, width=1278, height=35)
main_frame1 = Frame(t, bd=0, relief=RIDGE, bg="white")
main_frame1.place(x=0, y=40, width=1278, height=670)
# =======main-label
main_label = Label(main_frame, text="Library Management System",
font=("Times New Roman", 20, "bold"),
fg="white", bg="red")
main_label.pack()
# =======main-date
main_date = Label(main_frame, textvariable=date_f, font=("Times New
Roman", 12, "bold"), fg="white",
bg="red")
main_date.place(x=1095, y=10)
text.place()
#========funtion to read pdf delete or place a order
def book1():
t.destroy()
book.sr()
def read():
os.startfile("Encyclopedia of Comic Books and Graphic Novels
( PDFDrive ).pdf")
def read1():
os.startfile("Coraline Graphic Novel ( PDFDrive ).pdf")
def read2():
os.startfile("Survivors - A Novel of the Coming Collapse
( PDFDrive ).pdf")
def read3():
os.startfile("The Essential Rumi by Coleman Barks ( PDFDrive ).pdf")
def read4():
os.startfile("The Gifts of Imperfection_ Embrace Who You Are
( PDFDrive ).pdf")
def read5():
os.startfile("The Year of the Flood_ A Novel ( PDFDrive ).pdf")
def read6():
os.startfile("Then She Was Gone_ A Novel ( PDFDrive ).pdf")
def read7():
os.startfile("The fault in our star.pdf")
#textsection
L10=Label(text='Encyclopedia of Comic Books')
L10.place(x=1,y=100)
L11=Label(text='Coraline Graphic Novel')
L11.place(x=200,y=100)
L12=Label(text='Survivors ')
L12.place(x=400,y=100)
L13=Label(text='The Essential Rumi')
L13.place(x=600,y=100)
L14=Label(text='The Gifts of Imperfection')
L14.place(x=1,y=300)
L15=Label(text='The Year of the Flood')
L15.place(x=200,y=300)
L16=Label(text='Then She Was Gone')
L16.place(x=400,y=300)
L17=Label(text='The fault in our star')
L17.place(x=600,y=300)
#----------book Button----------
b9=Button(text="book",command=book1)
b9.place(x=1,y=150)
b10=Button(text="book",command=book1)
b10.place(x=200,y=150)
b11=Button(text="book",command=book1)
b11.place(x=400,y=150)
b12=Button(text="book",command=book1)
b12.place(x=600,y=150)
b13=Button(text="book",command=book1)
b13.place(x=1,y=360)
b14=Button(text="book",command=book1)
b14.place(x=200,y=360)
b15=Button(text="book",command=book1)
b15.place(x=400,y=360)
b16=Button(text="book",command=book1)
b16.place(x=600,y=360)
#---------read here--------
b91=Button(text="Read",command=read)
b91.place(x=1,y=200)
b101=Button(text="Read",command=read1)
b101.place(x=200,y=200)
b111=Button(text="Read",command=read2)
b111.place(x=400,y=200)
b121=Button(text="Read",command=read3)
b121.place(x=600,y=200)
b131=Button(text="Read",command=read4)
b131.place(x=1,y=400)
b141=Button(text="read",command=read5)
b141.place(x=200,y=400)
b151=Button(text="Read",command=read6)
b151.place(x=400,y=400)
b161=Button(text="Read",command=read7)
b161.place(x=600,y=400)
def rt():
t.destroy()
book.sw()
def rtw():
t.destroy()
book.sdw()
b162 = Button(text="show booking", command=rt)
b162.place(x=300, y=550)
b163 = Button(text="delete booking", command=rtw)
b163.place(x=200, y=550)
t.mainloop()
READ BUTTON output – pdf get open for reading
#this contain code of booking and deleting and seeing ur booking
import os
import os.path
import datetime
con=sqlite3.Connection("Booking")
cur=con.cursor()
prvfrm = None
if (prvfrm != None):
prvfrm.destroy()
te = Tk()
te.geometry("650x550") # fullscreen
x = datetime.datetime.now()
y = x.strftime("%d")
z = x.strftime("%B")
a = x.strftime("%Y")
# =======main-label
fg="white", bg="red")
main_label.pack()
E1 = Entry(te)
E1.place(x=65,y=50)
L2 = Label(text="address").place(y=100)
E2 = Entry(te)
E2.place(x=60,y=100)
L3 = Label(text="mob").place(y=150)
E3 = Entry( te)
E3.place(x=60,y=150)
L4 = Label(text="qty number").place(y=200)
E4 = Entry(te)
E4.place(x=80,y=200)
L5 = Label(text="book name").place(y=250)
E5 = Entry(te)
E5.place(x=80,y=250)
def db():
if os.path.isfile(E1.get()):
if os.path.isfile(E5.get()):
con.commit()
a = cur.fetchall()
ab = int(E4.get())
if os.path.isfile(E5.get()):
r=open("d1")
f=r.read().split(":")
cost=int(f[1])
ac = ab * cost
te.destroy()
os.system("library.py")
else:
else:
messagebox.showinfo("ERROR","username invalid")
b161=Button(text="confirm booking",command=db)
b161.place(x=200,y=350)
te.mainloop()
prvfrm = None
if (prvfrm != None):
prvfrm.destroy()
te = Tk()
te.geometry("650x550") # fullscreen
x = datetime.datetime.now()
y = x.strftime("%d")
z = x.strftime("%B")
a = x.strftime("%Y")
# =======main-label
fg="white", bg="red")
main_label.pack()
E1 = Entry(te)
E1.place(x=170, y=100)
def db():
if os.path.isfile(E1.get()):
a = cur.fetchall()
if len(a)!=0:
messagebox.showinfo('Find', a)
te.destroy()
os.system("library.py")
else:
te.destroy()
os.system("library.py")
else:
messagebox.showinfo("ERROR","username invalid")
b161.place(x=100, y=180)
te.mainloop()
prvfrm = None
if (prvfrm != None):
prvfrm.destroy()
te = Tk()
te.geometry("650x550") # fullscreen
x = datetime.datetime.now()
y = x.strftime("%d")
z = x.strftime("%B")
a = x.strftime("%Y")
# =======main-label
fg="white", bg="red")
main_label.pack()
E1 = Entry(te)
E1.place(x=100, y=100)
E5 = Entry(te)
E5.place(x=100, y=139)
def db():
if os.path.isfile(E1.get()):
con.commit()
te.destroy()
os.system("library.py")
else:
messagebox.showinfo("ERROR","username invalid")
b161 = Button(text="Delete booking", command=db)