Professional Documents
Culture Documents
AISSCE ROLLNO:
Last but not least I am also thankful to all those whose names are not
mentioned above but helped encourage and inspire me knowing or
unknowing in doing this work.
PREFACE
The software provides a secure database with front-end as python(using
python IDLE) which is a simple, fast and MySQLtable file as data storage
as backend. The software adds, modifies & deletes records in the
database through the front-end which is easy to implement.
● RAM : 1 GB
●
BACKEND:
● MYSQL TABLE STRUCTURE
● PROGRAM CODE
import mysql.connector as q
import tkinter as t
cn=q.connect(host='localhost',user='root',passwd='lps123',database='empl1')
def add_rec():
global menu
menu.destroy()
global add
add=t.Tk()
add.geometry('600 x 500+350+100')
add.title('Insert')
add['background']='cyan'
h=t.Label(add,text='ADDING
DETAILS',font=('algerian',30),fg='black').place(relx=0.5,rely=0.1,anchor='center')
cr=cn.cursor()
h1=t.Label(add,text='Employee
Id:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.3,anchor='e')
e1=t.Entry(add)
e1.place(relx=0.55,rely=0.3,anchor='w')
h2=t.Label(add,text='Employee
Name:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.4,anchor='e')
e2=t.Entry(add)
e2.place(relx=0.55,rely=0.4,anchor='w')
h3=t.Label(add,text='Salary:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.5,anchor='e')
e3=t.Entry(add)
e3.place(relx=0.55,rely=0.5,anchor='w')
h4=t.Label(add,text='Employee
Department:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.6,anchor='e')
e4=t.Entry(add)
e4.place(relx=0.55,rely=0.6,anchor='w')
h5=t.Label(add,text='Date of
Joining:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.7,anchor='e')
e5=t.Entry(add)
e5.place(relx=0.55,rely=0.7,anchor='w')
def addr():
q=q.format(e1.get(),e2.get(),e3.get(),e4.get(),e5.get())
print(q)
cr.execute(q)
cn.commit()
s=t.Button(add,text='Add
Record',command=addr,font='castellar',bg='white',fg='black').place(relx=0.5,rely=0.8,anchor='center')
b=t.Button(add,text='Back',command=backa,font='castellar',bg='white',fg='black').place(relx=0.1,rely=0.
9,anchor='sw')
def backa():
global add
add.destroy()
main_menu()
def disp():
global menu
menu.destroy()
global dis
dis=t.Tk()
dis.title('Display')
dis.geometry('700 x 600+300+50')
dis['background']='cyan'
h=t.Label(dis,text='EMPLOYEE DETAILS',font=('algerian',30),fg='black')
h.place(relx=0.5,rely=0.1,anchor='center')
a=t.Text(dis)
a.place(relx=0.5,rely=0.5,anchor='center')
cr=cn.cursor()
cr.execute(q)
d=cr.fetchall()
for k in d:
a.insert(t.END,str(k)+'\n')
b=t.Button(dis,text='Back',command=backs,font='castellar',bg='white',fg='black').place(relx=0.1,rely=0.9,
anchor='sw')
def backs():
global dis
dis.destroy()
main_menu()
def search():
global menu
menu.destroy()
def se():
global search
search=t.Tk()
search.geometry('500 x 300+400+200')
search.title('Search')
search['background']='cyan'
cr=cn.cursor()
h=t.Label(search,text='SEARCH DETAIL',font=('algerian',30),fg='black')
h.place(relx=0.5,rely=0.1,anchor='center')
h1=t.Label(search,text='Employee
Id:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.4,anchor='e')
e1=t.Entry(search)
e1.place(relx=0.55,rely=0.4,anchor='w')
def sear():
m=e1.get()
global search
search.destroy()
global seara
seara=t.Tk()
seara.geometry('700 x 600+300+50')
seara.title('Search')
seara['background']='cyan'
a=t.Text(seara)
a.place(relx=0.5,rely=0.5,anchor='center')
q=q.format(m)
cr.execute(q)
d=cr.fetchall()
for k in d:
a.insert(t.END,str(k)+'\n')
def sea():
global seara
seara.destroy()
se()
b=t.Button(seara,text='Back',command=sea,font='castellar',bg='white',fg='black').place(relx=0.1,rely=0.9,
anchor='sw')
s=t.Button(search,text='Search',command=sear,font='castellar',bg='white',fg='black').place(relx=0.5,rely=
0.7,anchor='center')
b=t.Button(search,text='Back',command=backs,font='castellar',bg='white',fg='black').place(relx=0.1,rely=
0.9,anchor='sw')
se()
def backs():
global search
search.destroy()
main_menu()
def update():
global menu
menu.destroy()
global updt
updt=t.Tk()
updt.geometry('600 x 400+350+150')
updt.title('Update')
updt['background']='cyan'
h=t.Label(updt,text='UPDATE DETAILS',font=('algerian',30),fg='black')
h.place(relx=0.5,rely=0.1,anchor='center')
cr=cn.cursor()
h1=t.Label(updt,text='Employee
Id:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.3,anchor='e')
e1=t.Entry(updt)
e1.place(relx=0.55,rely=0.3,anchor='w')
h3=t.Label(updt,text='Updated
Salary:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.4,anchor='e')
e3=t.Entry(updt)
e3.place(relx=0.55,rely=0.4,anchor='w')
h4=t.Label(updt,text='Updated
Department:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.5,anchor='e')
e4=t.Entry(updt)
e4.place(relx=0.55,rely=0.5,anchor='w')
def upd():
q="update employee set salary={},dept='{}' where eid={};"
q=q.format(e3.get(),e4.get(),e1.get())
print(q)
cr.execute(q)
cn.commit()
s=t.Button(updt,text='Update',command=upd,font='castellar',bg='white',fg='black').place(relx=0.5,rely=0
.7,anchor='center')
b=t.Button(updt,text='Back',command=backu,font='castellar',bg='white',fg='black').place(relx=0.1,rely=0.
9,anchor='sw')
def backu():
global updt
updt.destroy()
main_menu()
def del_rec():
global menu
menu.destroy()
global dele
dele=t.Tk()
dele.title('Delete')
dele.geometry('500x300+400+200')
dele['background']='cyan'
h=t.Label(dele,text='DELETE DETAILS',font=('algerian',30),fg='black')
h.place(relx=0.5,rely=0.1,anchor='center')
h1=t.Label(dele,text='Employee
Id:',font='castellar',bg='white',fg='black').place(relx=0.45,rely=0.4,anchor='e')
e1=t.Entry(dele)
e1.place(relx=0.55,rely=0.4,anchor='w')
cr=cn.cursor()
def delu():
q=q.format(e1.get())
print(q)
cr.execute(q)
s=t.Button(dele,text='Delete',command=delu,font='castellar',bg='white',fg='black').place(relx=0.5,rely=0.
6,anchor='center')
b=t.Button(dele,text='Back',command=backde,font='castellar',bg='white',fg='black').place(relx=0.1,rely=0
.9,anchor='sw')
def backde():
global dele
dele.destroy()
main_menu()
def graph():
cr=cn.cursor()
cr.execute(q)
d=cr.fetchall()
x=[];y=[]
for k in d:
x.append(k[1])
y.append(k[2])
plt.bar(x,y)
plt.title('Salary')
plt.xlabel('Names')
plt.ylabel('Salary')
plt.show()
def bye():
global menu
menu.destroy()
cn.close()
print('Thank You')
def main_menu():
global menu
menu=t.Tk()
menu.geometry('600x550+350+75')
menu['background']='cyan'
menu.title('EMPLOYEE MANAGEMENT')
h=t.Label(menu,text='EMPLOYEE MANAGEMENT',font=('algerian',30),fg='black')
h.place(relx=0.5,rely=0.1,anchor='center')
op1=t.Button(menu,text='1.Display',command=disp,font='castellar',bg='white',fg='black')
op1.place(relx=0.5,rely=0.3,anchor='center')
op2=t.Button(menu,text='2.Add Record',command=add_rec,font='castellar',bg='white',fg='black')
op2.place(relx=0.5,rely=0.4,anchor='center')
op3=t.Button(menu,text='3.Update
Record',command=update,font='castellar',bg='white',fg='black')
op3.place(relx=0.5,rely=0.5,anchor='center')
op4=t.Button(menu,text='4.Delete Record',command=del_rec,font='castellar',bg='white',fg='black')
op4.place(relx=0.5,rely=0.6,anchor='center')
op5=t.Button(menu,text='5.Search',command=search,font='castellar',bg='white',fg='black')
op5.place(relx=0.5,rely=0.7,anchor='center')
op6=t.Button(menu,text='6.Graph',command=graph,font='castellar',bg='white',fg='black')
op6.place(relx=0.5,rely=0.8,anchor='center')
op7=t.Button(menu,text='7.Exit',command=bye,font='castellar',bg='white',fg='black')
op7.place(relx=0.5,rely=0.9,anchor='center')
def check():
ud=e1.get()
pd=e2.get()
home.destroy()
main_menu()
else:
home=t.Tk()
home.title('Login Form')
h=t.Label(home,text='LOGIN',font=('algerian',30),fg='black').place(relx=0.5,rely=0.1,anchor='center')
home['background']='light blue'
home.geometry('350x300+500+200')
u1=t.Label(home,text='User Id:',font='Castellar',bg='white',fg='black')
u1.place(relx=0.45,rely=0.3,anchor='e')
e1=t.Entry(home)
e1.place(relx=0.55,rely=0.3,anchor='w')
u2=t.Label(home,text='Password:',font='Castellar',bg='white',fg='black')
u2.place(relx=0.45,rely=0.5,anchor='e')
e2=t.Entry(home)
e2.place(relx=0.55,rely=0.5,anchor='w')
b=t.Button(home,text='OK',command=check,font='Castellar',bg='white',fg='black')
b.place(relx=0.5,rely=0.7,anchor='center')
t.mainloop()
BIBLIOGRAPHY:
1. www.google.com
2. www.wikipedia.com