-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgui.py
380 lines (291 loc) · 11.4 KB
/
gui.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
from practice import *
from tkinter import *
from tkinter import messagebox
studll=DLL()
def sel():
print ("POP")
#selection = "You selected the option " + str(br.get())
#label.config(text = selection)
def quit_(event):
print ("Quiting")
import sys
sys.exit()
lib=Tk()
lib.geometry("1280x720")
lib.focus_force()
lib.resizable(0,0)
lib.title('LIBRARY MANAGEMENT SYSTEM')
def fetch_student(event):
reg_stud=Toplevel(lib)
reg_stud.geometry("800x720")
reg_stud.focus_force()
reg_stud.resizable(0,0)
reg_stud.title('LIBRARY MANAGEMENT SYSTEM : TEACHERs MENU / REGISTER A STUDENT')
reg_stud.config(background="Sky Blue")
lbf=LabelFrame(reg_stud,text="yup")
lbf.pack(fill="both",expand="yes")
namlabel=Label(lbf,text=" NAME ")
namlabel.pack()
nam=Entry(lbf,textvariable=" NAME ",bg="Sky Blue",fg="Green")
nam.pack()
prnlabel=Label(lbf,text=" PRN ")
prnlabel.pack()
prn_=Entry(lbf,textvariable=" PRN ",bg="Sky Blue",fg="Green")
prn_.pack()
br_label=Label(lbf,text="branch")
br_label.pack()
br=Entry(lbf,textvariable="Branch")
br.pack()
emaillabel=Label(lbf,text=" EMAIL ")
emaillabel.pack()
eml=Entry(lbf,textvariable=" EMAIL",bg="Sky Blue",fg="Green")
eml.pack()
def reg_student():
try:
name = nam.get()
prn = prn_.get()
email=eml.get()
branch=br.get()
studll.add(Student(name,prn,branch,email))
messagebox.showinfo("Confirmation",str(nam.get())+" IS REGISTERED ")
except Exception as e:
messagebox.showinfo("Error"," error encountered "+str(e))
CBT=Button(lbf,text=" REGISTER ",font=("Liberation Sans",9,"bold"),bg="green",fg="white",command=reg_student,bd=1)
CBT.pack(anchor=CENTER)
reg_stud.mainloop()
def del_student(event):
del_stud=Toplevel(lib)
del_stud.geometry("800x720")
del_stud.focus_force()
del_stud.resizable(0,0)
del_stud.title('LIBRARY MANAGEMENT SYSTEM : TEACHERs MENU / DELETE A STUDENT')
del_stud.config(background="Sky Blue")
frame=Frame(del_stud)
frame.pack(anchor=CENTER)
l1=Label(frame,text="PRN")
l1.pack()
prn_=Entry(frame,textvariable=" PRN",bg="Sky Blue",fg="Green")
prn_.pack()
def del_stu():
studll.remove(prn_.get())
messagebox.showinfo("Confirmation",str(prn_.get())+" IS DELETED FROM THE LIST")
b1=Button(frame,text=" DELETE ",font=("Liberation Sans",9,"bold"),bg="green",fg="white",command=del_stu,bd=1)
b1.pack(anchor=CENTER)
del_stud.mainloop()
def display_student(event):
teacher_window = Toplevel(lib)
teacher_window.geometry("800x720")
teacher_window.focus_force()
teacher_window.resizable(0,0)
teacher_window.title('LIBRARY MANAGEMENT SYSTEM : TEACHERs MENU')
teacher_window.config(background="Sky Blue")
frame=Frame(teacher_window)
frame.pack(anchor=CENTER)
res=studll.display()
text1=Text(frame)
text1.pack()
text1.insert(END,res)
teacher_window.mainloop()
def add_book_in_lib(event):
ab=Toplevel(lib)
ab.geometry("800x720")
ab.focus_force()
ab.resizable(0,0)
ab.title('LIBRARY MANAGEMENT SYSTEM : TEACHERs MENU / REGISTER A STUDENT')
ab.config(background="Sky Blue")
lbf=LabelFrame(ab,text="yup")
lbf.pack(fill="both",expand="yes")
namlabel=Label(lbf,text=" NAME OF THE BOOK :")
namlabel.pack()
namb=Entry(lbf,textvariable=" NAME ",bg="Sky Blue",fg="Green")
namb.pack()
author_name=Label(lbf,text=" AUTHOR NAME ")
author_name.pack()
an=Entry(lbf,textvariable=" AUTHOR NAME ",bg="Sky Blue",fg="Green")
an.pack()
quanl=Label(lbf,text=" QUANTITY")
quanl.pack()
quan=Entry(lbf,textvariable=" QUANTITY ")
quan.pack()
def add_book_m():
try:
name=namb.get()
authorname=an.get()
quantity=quan.get()
books_data.add_book(name,authorname,quantity)
messagebox.showinfo("Confirmation",str(name)+" BOOK ADDED ")
except Exception as e:
messagebox.showinfo("ERROR","Error encountered "+str(e))
b1=Button(lbf,text=" ADD BOOK ",font=("Liberation Sans",9,"bold"),bg="green",fg="white",command=add_book_m,bd=1)
b1.pack(anchor=CENTER)
ab.mainloop()
def fetch_book_holders(event):
ab=Toplevel(lib)
ab.geometry("800x720")
ab.focus_force()
ab.resizable(0,0)
ab.title('LIBRARY MANAGEMENT SYSTEM : TEACHERs MENU / BOOK HOLDERS DETAILS')
ab.config(background="Sky Blue")
lbf=LabelFrame(ab,text="yup")
lbf.pack(fill="both",expand="yes")
namlabel=Label(lbf,text=" NAME OF THE BOOK :")
namlabel.pack()
namb=Entry(lbf,textvariable=" NAME ",bg="Sky Blue",fg="Green")
namb.pack()
def search_book_holder():
res=books_holders_data(namb.get())
frame=Frame(ab)
frame.pack(anchor=CENTER)
text1=Text(frame)
text1.pack()
text1.insert(END,res)
b1=Button(lbf,text=" SEARCH ",font=("Liberation Sans",9,"bold"),bg="green",fg="white",command=search_book_holder,bd=1)
b1.pack(anchor=CENTER)
ab.mainloop()
def teacher(event):
teacher_window = Toplevel(lib)
teacher_window.geometry("800x720")
teacher_window.focus_force()
teacher_window.resizable(0,0)
teacher_window.title('LIBRARY MANAGEMENT SYSTEM : TEACHERs MENU')
teacher_window.config(background="Sky Blue")
frame=Frame(teacher_window)
frame.pack(anchor=CENTER)
rt1=Button(frame,text=" REGISTER A NEW STUDENT")
rt1.pack( anchor = CENTER )
rt1.bind('<Button-1>',fetch_student)
rt2=Button(frame,text=" Delete A STUDENT")
rt2.pack( anchor = CENTER )
rt2.bind('<Button-1>',del_student)
rt3=Button(frame,text=" SEE ALL THE STUDENT")
rt3.pack( anchor = CENTER )
rt3.bind('<Button-1>',display_student)
rt4=Button(frame,text=" ADD BOOKS")
rt4.pack( anchor = CENTER )
rt4.bind('<Button-1>',add_book_in_lib)
rt5=Button(frame,text=" SEE CURRENT BOOK HOLDERS DETAILS")
rt5.pack( anchor = CENTER )
rt5.bind('<Button-1>',fetch_book_holders)
teacher_window.mainloop()
def explore_lib(event):
res=books_data.show_books()
teacher_window = Toplevel(lib)
teacher_window.geometry("800x720")
teacher_window.focus_force()
teacher_window.resizable(0,0)
teacher_window.title('LIBRARY MANAGEMENT SYSTEM : STUDENTs MENU : SEE YOUR STATUS')
teacher_window.config(background="Sky Blue")
frame=Frame(teacher_window)
frame.pack(anchor=CENTER)
text1=Text(frame)
text1.pack()
text1.insert(END,res)
teacher_window.mainloop()
def student_win(event):
stu_window = Toplevel(lib)
stu_window.geometry("800x720")
stu_window.focus_force()
stu_window.resizable(0,0)
stu_window.title('LIBRARY MANAGEMENT SYSTEM')
stu_window.config(background="Sky Blue")
frame1=Frame(stu_window)
frame1.pack(anchor=CENTER)
l1=Label(frame1,text=" PRN ")
l1.pack()
prn1=Entry(frame1,textvariable="PRN")
prn1.pack()
def can_enter():
stu_adr=studll.search(prn1.get())
if stu_adr is not None:
frame=Frame(stu_window)
frame.pack(anchor=CENTER)
rt1=Button(frame,text=" EXPLORE THE LIBRARY ")
rt1.pack( anchor = CENTER )
rt1.bind('<Button-1>',explore_lib)
def take_book(event):
tkb=Toplevel(lib)
tkb.geometry("800x720")
tkb.focus_force()
tkb.resizable(0,0)
tkb.title('LIBRARY MANAGEMENT SYSTEM')
tkb.config(background="Sky Blue")
frame1=Frame(tkb)
frame1.pack(anchor=CENTER)
l1=Label(frame1,text=" BOOK NAME ")
l1.pack()
bk=Entry(frame1,textvariable="BOOK NAME")
bk.pack()
def issue_book():
res=library.issue_book(stu_adr,bk.get())
if len(res) < 3 :
messagebox.showinfo("Confirmation",str(bk.get())+" ISSUED")
else:
messagebox.showinfo("NOT ISSUES",res)
CBS1=Button(frame1,text=" Confirm BOOK NAME ",font=("Liberation Sans",9,"bold"),bg="green",fg="white",command= issue_book , bd=1)
CBS1.pack(anchor=CENTER)
rt2=Button(frame,text=" TAKE A BOOK")
rt2.pack( anchor = CENTER )
rt2.bind('<Button-1>',take_book)
def return_book(event):
tkb=Toplevel(lib)
tkb.geometry("800x720")
tkb.focus_force()
tkb.resizable(0,0)
tkb.title('LIBRARY MANAGEMENT SYSTEM')
tkb.config(background="Sky Blue")
frame1=Frame(tkb)
frame1.pack(anchor=CENTER)
l1=Label(frame1,text=" BOOK NAME ")
l1.pack()
bk=Entry(frame1,textvariable="BOOK NAME")
bk.pack()
def return_b():
res=library.return_book(stu_adr,bk.get())
if len(res) < 3 :
messagebox.showinfo("Confirmation",str(bk.get())+" RETURNED ")
else:
messagebox.showinfo("NOT ISSUES",res)
CBS1=Button(frame1,text=" Confirm BOOK NAME ",font=("Liberation Sans",9,"bold"),bg="green",fg="white",command= return_b , bd=1)
CBS1.pack(anchor=CENTER)
rt3=Button(frame,text=" RETURN A BOOK")
rt3.pack( anchor = CENTER )
rt3.bind('<Button-1>',return_book)
def status(event):
teacher_window = Toplevel(lib)
teacher_window.geometry("800x720")
teacher_window.focus_force()
teacher_window.resizable(0,0)
teacher_window.title('LIBRARY MANAGEMENT SYSTEM : STUDENTs MENU : SEE YOUR STATUS')
teacher_window.config(background="Sky Blue")
frame=Frame(teacher_window)
frame.pack(anchor=CENTER)
res=str(stu_adr.books_issued)
text1=Text(frame)
text1.pack()
text1.insert(END,res)
teacher_window.mainloop()
rt4=Button(frame,text=" SEE YOUR STATUS")
rt4.pack( anchor = CENTER )
rt4.bind('<Button-1>',status)
rt5=Button(frame,text=" EXIT ")
rt5.pack( anchor = CENTER )
rt5.bind('<Button-1>',quit_)
else:
messagebox.showinfo("NOT FOUND",str(prn1.get())+" NOT FOUND \n REGISTER AND COMEBACK AGAIN")
CBS=Button(frame1,text=" Confirm PRN ",font=("Liberation Sans",9,"bold"),bg="green",fg="white",command= can_enter , bd=1)
CBS.pack(anchor=CENTER)
"""
CBS=Button(frame,text=" Confirm Choice ",font=("Liberation Sans",9,"bold"),bg=" green ",fg=" white ",command= choice_sel_s , bd=1)
CBS.pack(anchor=CENTER)
"""
stu_window.mainloop()
filename = PhotoImage(file="libr.png")
background_label = Label(lib, image=filename)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
teacher_button=Button(lib,text="TEACHERS Click Here ",height=20,width=50,bg="yellow")
teacher_button.pack()
teacher_button.bind('<Button-1>',teacher)
student_button=Button(lib,text=" STUDENTS Clcik Here ",height=20,width=50,bg="Sky Blue")
student_button.pack()
student_button.bind('<Button-1>',student_win)
lib.mainloop()