-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main_page.py
1904 lines (1688 loc) · 113 KB
/
Main_page.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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import tkinter
import threading
import imageio
from tkinter import ttk
from tkinter import messagebox, scrolledtext
from tkinter import *
from PIL import ImageTk, Image
import tkcalendar
import sqlite3
import datetime
import pygame
import time
blood_val = 30
# dimensions, name and colour for the login main page
n = 1920
m = 1080
mainWindow = tkinter.Tk()
mainWindow.title("Login Page")
mainWindow.geometry("1920x1080+-5+-1")
mainWindow.configure(background="white")
# to find the logo in files
photos = [ImageTk.PhotoImage(Image.open("login_photo.jpg")), ImageTk.PhotoImage(Image.open("Password.jpg")),
ImageTk.PhotoImage(Image.open("Logo2.jpg")), ImageTk.PhotoImage(Image.open("contact_us.png")),
ImageTk.PhotoImage(Image.open("logout.jpg")), ImageTk.PhotoImage(Image.open("nav_con.png")),
ImageTk.PhotoImage(Image.open("close.jpg")), ImageTk.PhotoImage(Image.open("faq.png")),
ImageTk.PhotoImage(Image.open("users.png")), ImageTk.PhotoImage(Image.open("user data.png")),
ImageTk.PhotoImage(Image.open("data.png")), ImageTk.PhotoImage(Image.open("users2.jpg")),
ImageTk.PhotoImage(Image.open("Home.jpg")), ImageTk.PhotoImage(Image.open("user data2.jpg")),
ImageTk.PhotoImage(Image.open("queries (1) (1).jpg")), ImageTk.PhotoImage(Image.open("Ask Queries.jpg")),
ImageTk.PhotoImage(Image.open("Q&A background.png")), ImageTk.PhotoImage(Image.open("Send message.png")),
ImageTk.PhotoImage(Image.open("Clear message.png")), ImageTk.PhotoImage(Image.open("Back.png")),
ImageTk.PhotoImage(Image.open("contact_us2.jpg")), ImageTk.PhotoImage(Image.open("Sign_up_bg.jpg")),
ImageTk.PhotoImage(Image.open("icons8-search-bar-100.png"))]
# to place the logo on the login page
background = tkinter.Label(mainWindow, image=photos[2]).pack(fill="y")
# The following are functions for buttons (functions as in commands)
# register command when register button is pressed
def register():
# to make another window that contains registration details
register_window = Toplevel()
register_window.title("Register")
register_window.geometry("1920x1080+-5+-1")
register_window.configure(background="red2")
# to set the bg of the register page
bg_label = tkinter.Label(register_window, image=photos[21])
bg_label.place(x=-4, y=-33)
register_frame = tkinter.LabelFrame(register_window, bd=10)
register_frame.place(x=150, y=150, width=1620, height=750)
label1 = tkinter.Label(register_frame, text="Sign Up", font=("caliber", 30, "bold"))
label1.place(x=700, y=10)
# to make labels and entries such as username, email ,DOB in this page
username_label = tkinter.Label(register_frame, text="Username", font=("caliber", 25, "bold"))
username_label.place(x=10, y=110)
password_label = tkinter.Label(register_frame, text="Password", font=("caliber", 25, "bold"))
password_label.place(x=600, y=110)
email_label = tkinter.Label(register_frame, text="Email ", font=("caliber", 25, "bold"))
email_label.place(x=1090, y=110)
gender_label = tkinter.Label(register_frame, text="Gender", font=("caliber", 25, "bold"))
gender_label.place(x=10, y=250)
contact_label = tkinter.Label(register_frame, text="Contact", font=("caliber", 25, "bold"))
contact_label.place(x=500, y=250)
dob_label = tkinter.Label(register_frame, text="D.O.B", font=("caliber", 25, "bold"))
dob_label.place(x=1000, y=250)
address_label = tkinter.Label(register_frame, text="Address", font=("caliber", 25, "bold"))
address_label.place(x=10, y=390)
username_entry = tkinter.Entry(register_frame, font=("caliber", 16, "normal"), relief="groove")
username_entry.place(x=230, y=120, width=300)
password_entry = tkinter.Entry(register_frame, font=("caliber", 16, "normal"), relief="groove")
password_entry.place(x=820, y=120)
email_entry = tkinter.Entry(register_frame, font=("caliber", 16, "normal"), relief="groove")
email_entry.place(x=1250, y=120, width=250)
contact_entry = tkinter.Entry(register_frame, font=("caliber", 16, "normal"))
contact_entry.place(x=700, y=260)
gender_entry = ttk.Combobox(register_frame, width=20, state="readonly", font=("caliber", 16, "normal"))
gender_entry['values'] = ("Male", "Female", "Other")
gender_entry.place(x=180, y=260)
dob_entry = tkcalendar.DateEntry(register_frame, font=("large_font", 16, "italic"), date_pattern='dd/mm/yyyy')
dob_entry.place(x=1200, y=260)
address_entry = tkinter.Text(register_frame, font=("caliber", 16, "normal"))
address_entry.place(x=230, y=400, width=800, height=200)
date2 = dob_entry.get()
day2 = int(date2[:2])
month2 = int(date2[3:5])
year2 = int(date2[6:])
# when sigh_up is pressed after registration details are filled
def on_signup():
date = dob_entry.get()
day = int(date[:2])
month = int(date[3:5])
year = int(date[6:])
if year2 - year == 18:
if month2 - month >= 0:
if day2 - day >= 0:
age = 18
else:
age = year2 - year - 1
else:
age = year2 - year - 1
else:
age = year2 - year
if len(str(username_entry.get())) >= 10:
if len(password_entry.get()) >= 6:
if email_entry.get()[-4:] == ".com":
if len(contact_entry.get()) == 10:
if age >= 18:
if len(address_entry.get(1.0, 'end')) >= 20:
messagebox.showinfo("Success", "Hurray Sign-In Successful", parent=register_window)
current_date_time = datetime.datetime.now()
date_month_year = "{0}-{1}-{2}".format(current_date_time.day, current_date_time.month,
current_date_time.year)
time2 = "{0}:{1}:{2}".format(current_date_time.hour, current_date_time.minute,
current_date_time.second)
db = sqlite3.connect("sign_up.sqlite")
db.execute("CREATE TABLE IF NOT EXISTS sign_up(name TEXT, email TEXT, gender TEXT,"
" password TEXT,"
" phone TEXT, dob TEXT, age TEXT,"
" Address TEXT, date TEXT, time TEXT)")
db.execute("INSERT INTO sign_up(name, email, gender, password, phone, DOB, age, "
" Address, date, time) "
" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
(username_entry.get(), email_entry.get(), gender_entry.get(),
password_entry.get(), contact_entry.get(),
dob_entry.get(), age, address_entry.get(1.0, 'end'), date_month_year,
time2))
cursor = db.cursor()
cursor.execute("SELECT * FROM sign_up")
db.commit()
cursor.close()
db.close()
username_entry.delete(0, 'end')
password_entry.delete(0, 'end')
email_entry.delete(0, 'end')
contact_entry.delete(0, 'end')
address_entry.delete(1.0, 'end')
else:
messagebox.showerror("Error", "Please Enter your full address!!",
parent=register_window)
else:
messagebox.showerror("Error", "Please Wait for {0} year(s) more :)".format(18 - age),
parent=register_window)
else:
messagebox.showerror("Error", "Contact not valid!!", parent=register_window)
else:
messagebox.showerror("Error", "Invalid Email Address!!", parent=register_window)
else:
messagebox.showerror("Error", "Password should be strong(equivalent to 6 or more spaces)!!",
parent=register_window)
else:
messagebox.showerror("Error", "Please Enter your full name!!", parent=register_window)
# button frame
button_frame = Frame(register_frame, bd=5, relief="ridge", bg="grey")
button_frame.place(x=500, y=610, width=600, height=110)
# Sign up button
signup_button = tkinter.Button(button_frame, text=" Sign Up ", font=("caliber", 18, "italic"), relief="raised",
command=on_signup, bg="green", fg="white",)
signup_button.place(x=20, y=23)
back_button = tkinter.Button(button_frame, text=" Back ", font=("caliber", 18, "italic"), relief="raised",
command=register_window.destroy, bg="maroon", fg="white",)
back_button.place(x=230, y=23)
# when quit is pressed
def on_quit():
register_window.destroy()
mainWindow.destroy()
clear_button = tkinter.Button(button_frame, text=" Exit ", bg="red2", fg="white",
font=("caliber", 18, "italic"), relief="raised", command=on_quit)
clear_button.place(x=430, y=23)
register_window.mainloop()
def login():
name_list = []
name_last = username_entry_user.get()
pass_last = username_entry_password_user.get()
db_last = sqlite3.connect("sign_up.sqlite")
cursor_last = db_last.cursor()
cursor_last.execute("SELECT * FROM sign_up WHERE (name = ?)", [name_last])
name_list.append(cursor_last.fetchall())
for q in name_list:
for w in q:
if pass_last in w:
# to clear entry in requesting half
def on_clear():
name_entry.delete(0, 'end')
mail_entry.delete(0, 'end')
phone_entry.delete(0, 'end')
requirement_entry.delete(0, 'end')
blood_entry.delete(0, 'end')
# to clear entry in donation half
def on_clear2():
info_name_entry.delete(0, 'end')
info_email_entry.delete(0, 'end')
info_phone_entry.delete(0, 'end')
info_requirement_entry.delete(0, 'end')
info_b_entry.delete(0, 'end')
info_last_date_entry.delete(0, 'end')
# to delete entry in donating half
def on_del2():
def in_del2():
record2 = []
j = []
db = sqlite3.connect("donate.sqlite")
cursor = db.cursor()
cursor.execute("SELECT * FROM donate")
record2.append(cursor.fetchall())
name3 = username_entry_user.get()
cursor.execute("DELETE FROM donate WHERE (name = ?)", [name3])
for i in record2:
for k in i:
if k[0] == name3:
messagebox.showinfo("Success", "Data Deleted Successfully", parent=delete_page2)
j.append(k[0])
destroy()
if b_type2_entry.get() == "B+":
b_pos_str.set(int(b_pos_str.get()) - int(delete_req2_entry.get()))
elif b_type2_entry.get() == "B-":
b_neg_str.set(int(b_neg_str.get()) - int(delete_req2_entry.get()))
elif b_type2_entry.get() == "A+":
a_pos_str.set(int(a_pos_str.get()) - int(delete_req2_entry.get()))
elif b_type2_entry.get() == "A-":
a_neg_str.set(int(a_neg_str.get()) - int(delete_req2_entry.get()))
elif b_type2_entry.get() == "AB+":
ab_pos_str.set(int(ab_pos_str.get()) - int(delete_req2_entry.get()))
elif b_type2_entry.get() == "AB-":
ab_neg_str.set(int(ab_neg_str.get()) - int(delete_req2_entry.get()))
elif b_type2_entry.get() == "O+":
o_pos_str.set(int(o_pos_str.get()) - int(delete_req2_entry.get()))
elif b_type2_entry.get() == "O-":
o_neg_str.set(int(o_neg_str.get()) - int(delete_req2_entry.get()))
for i in range(100):
if name3 not in j:
messagebox.showerror("Error", "No such name in the database", parent=delete_page2)
break
# to display the new quantity of the set blood
a_pos_entry = tkinter.Entry(values, textvariable=a_pos_str, state="disabled",
font=("large_font", 15, "bold"))
a_pos_entry.place(x=100, y=15, width=40)
a_neg_entry = tkinter.Entry(values, textvariable=a_neg_str, state="disabled",
font=("large_font", 15, "bold"))
a_neg_entry.place(x=100, y=50, width=40)
b_pos_entry = tkinter.Entry(values, textvariable=b_pos_str, state="disabled",
font=("large_font", 15, "bold"))
b_pos_entry.place(x=100, y=85, width=40)
b_neg_entry = tkinter.Entry(values, textvariable=b_neg_str, state="disabled",
font=("large_font", 15, "bold"))
b_neg_entry.place(x=100, y=120, width=40)
ab_pos_entry = tkinter.Entry(values, textvariable=ab_pos_str, state="disabled",
font=("large_font", 15, "bold"))
ab_pos_entry.place(x=100, y=155, width=40)
ab_neg_entry = tkinter.Entry(values, textvariable=ab_neg_str, state="disabled",
font=("large_font", 15, "bold"))
ab_neg_entry.place(x=100, y=190, width=40)
o_pos_entry = tkinter.Entry(values, textvariable=o_pos_str, state="disabled",
font=("large_font", 15, "bold"))
o_pos_entry.place(x=100, y=225, width=40)
o_neg_entry = tkinter.Entry(values, textvariable=o_neg_str, state="disabled",
font=("large_font", 15, "bold"))
o_neg_entry.place(x=100, y=260, width=40)
db.commit()
cursor.execute("SELECT * FROM donate")
print(cursor.fetchall())
cursor.close()
db.close()
delete_page2.destroy()
delete_page2 = Toplevel()
delete_page2.title("Delete Entry")
delete_page2.geometry("550x350")
delete_page2.configure(bg="maroon")
delete_page2.wm_attributes("-alpha", 0.95)
delete_req2 = tkinter.Label(delete_page2, font=("caliber", 15, "bold"), text="Unit", fg="gold",
bg="dark blue")
delete_req2.place(x=30, y=50)
delete_req2_entry = Spinbox(delete_page2, from_=1, to=5, font=("large_font", 15, "normal"),
width=10)
delete_req2_entry.place(x=180, y=50)
b_type2 = tkinter.Label(delete_page2, font=("caliber", 15, "bold"), text="Blood Type", fg="gold",
bg="dark blue")
b_type2.place(x=30, y=110)
b_type2_entry = ttk.Combobox(delete_page2, font=("large_font", 15, "normal"), width=10)
b_type2_entry['values'] = ('A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-')
b_type2_entry.place(x=180, y=113)
delete2_button = tkinter.Button(delete_page2, text="Delete Data", font="large_font", bg="dark blue",
fg="gold",
command=in_del2)
delete2_button.place(x=150, y=220)
note2 = tkinter.LabelFrame(delete_page2, font="large_font", bg="dark blue")
note2.place(x=10, y=280, width=530, height=60)
note2_label = tkinter.Label(note2, text="Note: The Unit value must be same as that in data!!",
bg="dark blue",
fg="gold", font=("caliber", 14, "normal"))
note2_label.place(x=10, y=12)
# to delete entry in requesting half
def on_del():
def in_del():
record = []
j = []
db = sqlite3.connect("request.sqlite")
cursor = db.cursor()
cursor.execute("SELECT * FROM request")
record.append(cursor.fetchall())
name2 = username_entry_user.get()
cursor.execute("DELETE FROM request WHERE (name = ?)", [name2])
for i in record:
for k in i:
if k[0] == name2:
messagebox.showinfo("Success", "Data Deleted Successfully", parent=delete_page)
j.append(k[0])
destroy()
if b_type_entry.get() == "B+":
b_pos_str.set(int(b_pos_str.get()) + int(delete_req_entry.get()))
elif b_type_entry.get() == "B-":
b_neg_str.set(int(b_neg_str.get()) + int(delete_req_entry.get()))
elif b_type_entry.get() == "A+":
a_pos_str.set(int(a_pos_str.get()) + int(delete_req_entry.get()))
elif b_type_entry.get() == "A-":
a_neg_str.set(int(a_neg_str.get()) + int(delete_req_entry.get()))
elif b_type_entry.get() == "AB+":
ab_pos_str.set(int(ab_pos_str.get()) + int(delete_req_entry.get()))
elif b_type_entry.get() == "AB-":
ab_neg_str.set(int(ab_neg_str.get()) + int(delete_req_entry.get()))
elif b_type_entry.get() == "O+":
o_pos_str.set(int(o_pos_str.get()) + int(delete_req_entry.get()))
elif b_type_entry.get() == "O-":
o_neg_str.set(int(o_neg_str.get()) + int(delete_req_entry.get()))
for i in range(100):
if name2 not in j:
messagebox.showerror("Error", "No such name in the database", parent=delete_page)
break
db.commit()
cursor.execute("SELECT * FROM request")
print(cursor.fetchall())
cursor.close()
db.close()
delete_page.destroy()
# to display the new quantity of the set blood
a_pos_entry = tkinter.Entry(values, textvariable=a_pos_str, state="disabled",
font=("large_font", 15, "bold"))
a_pos_entry.place(x=100, y=15, width=40)
a_neg_entry = tkinter.Entry(values, textvariable=a_neg_str, state="disabled",
font=("large_font", 15, "bold"))
a_neg_entry.place(x=100, y=50, width=40)
b_pos_entry = tkinter.Entry(values, textvariable=b_pos_str, state="disabled",
font=("large_font", 15, "bold"))
b_pos_entry.place(x=100, y=85, width=40)
b_neg_entry = tkinter.Entry(values, textvariable=b_neg_str, state="disabled",
font=("large_font", 15, "bold"))
b_neg_entry.place(x=100, y=120, width=40)
ab_pos_entry = tkinter.Entry(values, textvariable=ab_pos_str, state="disabled",
font=("large_font", 15, "bold"))
ab_pos_entry.place(x=100, y=155, width=40)
ab_neg_entry = tkinter.Entry(values, textvariable=ab_neg_str, state="disabled",
font=("large_font", 15, "bold"))
ab_neg_entry.place(x=100, y=190, width=40)
o_pos_entry = tkinter.Entry(values, textvariable=o_pos_str, state="disabled",
font=("large_font", 15, "bold"))
o_pos_entry.place(x=100, y=225, width=40)
o_neg_entry = tkinter.Entry(values, textvariable=o_neg_str, state="disabled",
font=("large_font", 15, "bold"))
o_neg_entry.place(x=100, y=260, width=40)
delete_page = Toplevel()
delete_page.title("Delete Entry")
delete_page.geometry("550x350")
delete_page.configure(bg="maroon")
delete_page.wm_attributes("-alpha", 0.95)
delete_req = tkinter.Label(delete_page, font=("caliber", 15, "bold"), text="Requirement", fg="gold",
bg="dark blue")
delete_req.place(x=30, y=50)
delete_req_entry = Spinbox(delete_page, from_=1, to=5, font=("large_font", 15, "normal"), width=10)
delete_req_entry.place(x=180, y=50)
b_type = tkinter.Label(delete_page, font=("caliber", 15, "bold"), text="Blood Type", fg="gold",
bg="dark blue")
b_type.place(x=30, y=110)
b_type_entry = ttk.Combobox(delete_page, font=("large_font", 15, "normal"), width=10)
b_type_entry['values'] = ('A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-')
b_type_entry.place(x=180, y=113)
delete_button = tkinter.Button(delete_page, text="Delete Data", font="large_font", bg="dark blue",
fg="gold",
command=in_del)
delete_button.place(x=150, y=220)
note = tkinter.LabelFrame(delete_page, font="large_font", bg="dark blue")
note.place(x=10, y=280, width=530, height=60)
note_label = tkinter.Label(note, text="Note: The Req. value must be same as that in data!!",
bg="dark blue",
fg="gold", font=("caliber", 14, "normal"))
note_label.place(x=10, y=12)
# to destroy entries in requesting half
def destroy():
# to destroy 30 once donated
a_positive_entry.destroy()
a_negative_entry.destroy()
b_positive_entry.destroy()
b_negative_entry.destroy()
ab_positive_entry.destroy()
ab_negative_entry.destroy()
b_negative_entry.destroy()
o_positive_entry.destroy()
o_negative_entry.destroy()
# TO SET BLOOD ENTRY VALUES IN REQUESTING HALF
def blood_val_sub():
if blood_entry.get() == "B+":
b_pos_str.set(int(b_pos_str.get()) - int(requirement_entry.get()))
elif blood_entry.get() == "B-":
b_neg_str.set(int(b_neg_str.get()) - int(requirement_entry.get()))
elif blood_entry.get() == "A+":
a_pos_str.set(int(a_pos_str.get()) - int(requirement_entry.get()))
elif blood_entry.get() == "A-":
a_neg_str.set(int(a_neg_str.get()) - int(requirement_entry.get()))
elif blood_entry.get() == "AB+":
ab_pos_str.set(int(ab_pos_str.get()) - int(requirement_entry.get()))
elif blood_entry.get() == "AB-":
ab_neg_str.set(int(ab_neg_str.get()) - int(requirement_entry.get()))
elif blood_entry.get() == "O+":
o_pos_str.set(int(o_pos_str.get()) - int(requirement_entry.get()))
elif blood_entry.get() == "O-":
o_neg_str.set(int(o_neg_str.get()) - int(requirement_entry.get()))
# to add entry in donating half
def on_donate():
if username_entry_user.get() == info_name_entry.get():
if info_email_entry.get()[-4:] == ".com":
if len(info_phone_entry.get()) == 10:
if info_requirement_entry.get() in ('1', '2', '3', '4', '5'):
if len(info_b_entry.get()) > 1:
if info_last_date_entry.get() == "> 3" or\
info_last_date_entry.get() == "First time donation":
current_date_time = datetime.datetime.now()
date_month_year = "{0}-{1}-{2}".format(current_date_time.day,
current_date_time.month,
current_date_time.year)
time2 = "{0}:{1}:{2}".format(current_date_time.hour,
current_date_time.minute,
current_date_time.second)
db = sqlite3.connect("donate.sqlite")
db.execute("CREATE TABLE IF NOT EXISTS donate(name TEXT, email TEXT,"
" phone INTEGER,"
" requirement TEXT, blood TEXT, date TEXT, time TEXT)")
db.execute("INSERT INTO donate(name, email, phone, requirement, blood,"
" date, time) "
" VALUES(?, ?, ?, ?, ?, ?, ?)",
(info_name_entry.get(), info_email_entry.get(),
info_phone_entry.get(),
info_requirement_entry.get(), info_b_entry.get(),
date_month_year,
time2))
cursor = db.cursor()
cursor.execute("SELECT * FROM donate")
print(cursor.fetchall())
db.commit()
cursor.close()
db.close()
# to destroy and add a value to the blood val
if info_b_entry.get() == "B+":
b_pos_str.set(int(b_pos_str.get()) + int(info_requirement_entry.get()))
elif info_b_entry.get() == "B-":
b_neg_str.set(int(b_neg_str.get()) + int(info_requirement_entry.get()))
elif info_b_entry.get() == "A+":
a_pos_str.set(int(a_pos_str.get()) + int(info_requirement_entry.get()))
elif info_b_entry.get() == "A-":
a_neg_str.set(int(a_neg_str.get()) + int(info_requirement_entry.get()))
elif info_b_entry.get() == "AB+":
ab_pos_str.set(int(ab_pos_str.get()) +
int(info_requirement_entry.get()))
elif info_b_entry.get() == "AB-":
ab_neg_str.set(int(ab_neg_str.get()) +
int(info_requirement_entry.get()))
elif info_b_entry.get() == "O+":
o_pos_str.set(int(o_pos_str.get()) + int(info_requirement_entry.get()))
elif info_b_entry.get() == "O-":
o_neg_str.set(int(o_neg_str.get()) + int(info_requirement_entry.get()))
a_pos_entry = tkinter.Entry(values, textvariable=a_pos_str,
state="disabled",
font=("large_font", 15, "bold"))
a_pos_entry.place(x=100, y=15, width=40)
a_neg_entry = tkinter.Entry(values, textvariable=a_neg_str,
state="disabled",
font=("large_font", 15, "bold"))
a_neg_entry.place(x=100, y=50, width=40)
b_pos_entry = tkinter.Entry(values, textvariable=b_pos_str,
state="disabled",
font=("large_font", 15, "bold"))
b_pos_entry.place(x=100, y=85, width=40)
b_neg_entry = tkinter.Entry(values, textvariable=b_neg_str,
state="disabled",
font=("large_font", 15, "bold"))
b_neg_entry.place(x=100, y=120, width=40)
ab_pos_entry = tkinter.Entry(values, textvariable=ab_pos_str,
state="disabled",
font=("large_font", 15, "bold"))
ab_pos_entry.place(x=100, y=155, width=40)
ab_neg_entry = tkinter.Entry(values, textvariable=ab_neg_str,
state="disabled",
font=("large_font", 15, "bold"))
ab_neg_entry.place(x=100, y=190, width=40)
o_pos_entry = tkinter.Entry(values, textvariable=o_pos_str,
state="disabled",
font=("large_font", 15, "bold"))
o_pos_entry.place(x=100, y=225, width=40)
o_neg_entry = tkinter.Entry(values, textvariable=o_neg_str,
state="disabled",
font=("large_font", 15, "bold"))
o_neg_entry.place(x=100, y=260, width=40)
on_clear2()
else:
messagebox.showerror("Error", "You must wait at least for 3 "
"months before donating"
" again", parent=login_window)
else:
messagebox.showerror("Error", "Invalid Blood Type", parent=login_window)
else:
messagebox.showerror("Error", "Requirement should be between 0 and 6",
parent=login_window)
else:
messagebox.showerror("Error", "Invalid Contact!!", parent=login_window)
else:
messagebox.showerror("Error", "Invalid Email!!", parent=login_window)
else:
messagebox.showerror("Error", "Your name should match with username", parent=login_window)
# to clear entries once donate button is pressed
on_clear2()
def on_add():
# on pressing add request button
if username_entry_user.get() == name_entry.get():
if mail_entry.get()[-4:] == ".com":
if len(phone_entry.get()) == 10:
if requirement_entry.get() in ('1', '2', '3', '4', '5'):
if len(blood_entry.get()) > 1:
current_date_time = datetime.datetime.now()
date_month_year = "{0}-{1}-{2}".format(current_date_time.day,
current_date_time.month,
current_date_time.year)
time2 = "{0}:{1}:{2}".format(current_date_time.hour, current_date_time.minute,
current_date_time.second)
db = sqlite3.connect("request.sqlite")
db.execute("CREATE TABLE IF NOT EXISTS request(name TEXT, email TEXT,"
" phone INTEGER,"
" requirement TEXT, blood TEXT, date TEXT, time TEXT)")
db.execute("INSERT INTO request(name, email, phone, requirement, blood,"
" date, time) "
" VALUES(?, ?, ?, ?, ?, ?, ?)",
(name_entry.get(), mail_entry.get(), phone_entry.get(),
requirement_entry.get(),
blood_entry.get(), date_month_year, time2))
cursor = db.cursor()
cursor.execute("SELECT * FROM request")
print(cursor.fetchall())
db.commit()
cursor.close()
db.close()
destroy()
blood_val_sub()
# to display the new quantity of the set blood
a_pos_entry = tkinter.Entry(values, textvariable=a_pos_str, state="disabled",
font=("large_font", 15, "bold"))
a_pos_entry.place(x=100, y=15, width=40)
a_neg_entry = tkinter.Entry(values, textvariable=a_neg_str, state="disabled",
font=("large_font", 15, "bold"))
a_neg_entry.place(x=100, y=50, width=40)
b_pos_entry = tkinter.Entry(values, textvariable=b_pos_str, state="disabled",
font=("large_font", 15, "bold"))
b_pos_entry.place(x=100, y=85, width=40)
b_neg_entry = tkinter.Entry(values, textvariable=b_neg_str, state="disabled",
font=("large_font", 15, "bold"))
b_neg_entry.place(x=100, y=120, width=40)
ab_pos_entry = tkinter.Entry(values, textvariable=ab_pos_str, state="disabled",
font=("large_font", 15, "bold"))
ab_pos_entry.place(x=100, y=155, width=40)
ab_neg_entry = tkinter.Entry(values, textvariable=ab_neg_str, state="disabled",
font=("large_font", 15, "bold"))
ab_neg_entry.place(x=100, y=190, width=40)
o_pos_entry = tkinter.Entry(values, textvariable=o_pos_str, state="disabled",
font=("large_font", 15, "bold"))
o_pos_entry.place(x=100, y=225, width=40)
o_neg_entry = tkinter.Entry(values, textvariable=o_neg_str, state="disabled",
font=("large_font", 15, "bold"))
o_neg_entry.place(x=100, y=260, width=40)
on_clear()
else:
messagebox.showerror("Error", "Invalid Blood Type", parent=login_window)
else:
messagebox.showerror("Error", "Requirement should be between 0 and 6",
parent=login_window)
else:
messagebox.showerror("Error", "Invalid Contact!!", parent=login_window)
else:
messagebox.showerror("Error", "Invalid Email!!", parent=login_window)
else:
messagebox.showerror("Error", "Your name should match with username", parent=login_window)
def my_donations():
# to display my donations
my_donation_page = Toplevel()
my_donation_page.title("My donation data")
my_donation_page.geometry("1420x440")
my_donation_page.resizable(False, False)
my_donation_page.config(bg="maroon")
# to print the data
collect = []
data = sqlite3.connect('donate.sqlite')
cursor1 = data.cursor()
name3 = username_entry_user.get()
cursor1.execute("SELECT * FROM donate WHERE (name = ?)", [name3])
rows = cursor1.fetchall()
print(rows)
collect.append(cursor1.fetchall())
style = ttk.Style()
style.configure("mystyle.Treeview", bd=5, font=("caliber", 15))
tree_view_my_donations = ttk.Treeview(my_donation_page, columns=(1, 2, 3, 4, 5, 6, 7),
show="headings",
height=20, style="mystyle.Treeview")
tree_view_my_donations.place(x=5, y=5)
tree_view_my_donations.heading(1, text="Name")
tree_view_my_donations.heading(2, text="Email")
tree_view_my_donations.heading(3, text="Contact")
tree_view_my_donations.heading(4, text="Units")
tree_view_my_donations.heading(5, text="Blood Type")
tree_view_my_donations.heading(6, text="Date (DD-MM-YYYY)")
tree_view_my_donations.heading(7, text="Time (Hr:Min:Sec)")
tree_view_my_donations.column(1, width=350)
tree_view_my_donations.column(2, width=350)
tree_view_my_donations.column(3, width=150)
tree_view_my_donations.column(4, width=100)
tree_view_my_donations.column(5, width=100)
for i in rows:
tree_view_my_donations.insert('', 'end', values=i)
def my_requests():
# to display my requests
my_requests_page = Toplevel()
my_requests_page.title("My request data")
my_requests_page.geometry("1420x440")
my_requests_page.config(bg="maroon")
my_requests_page.resizable(False, False)
# to print the data
collect2 = []
data2 = sqlite3.connect('request.sqlite')
cursor2 = data2.cursor()
name5 = username_entry_user.get()
cursor2.execute("SELECT * FROM request WHERE (name = ?)", [name5])
rows = cursor2.fetchall()
print(rows)
collect2.append(cursor2.fetchall())
style = ttk.Style()
style.configure("mystyle.Treeview", bd=5, font=("caliber", 15))
tree_view_my_requests = ttk.Treeview(my_requests_page, columns=(1, 2, 3, 4, 5, 6, 7),
show="headings",
height=20, style="mystyle.Treeview")
tree_view_my_requests.place(x=5, y=5)
tree_view_my_requests.heading(1, text="Name")
tree_view_my_requests.heading(2, text="Email")
tree_view_my_requests.heading(3, text="Contact")
tree_view_my_requests.heading(4, text="Requirement")
tree_view_my_requests.heading(5, text="Blood Type")
tree_view_my_requests.heading(6, text="Date (DD-MM-YYYY)")
tree_view_my_requests.heading(7, text="Time (Hr:Min:Sec)")
tree_view_my_requests.column(1, width=350)
tree_view_my_requests.column(2, width=350)
tree_view_my_requests.column(3, width=150)
tree_view_my_requests.column(4, width=100)
tree_view_my_requests.column(5, width=100)
for i in rows:
tree_view_my_requests.insert('', 'end', values=i)
def log_out():
ask = tkinter.messagebox.askquestion(" ", "Are you Sure you want to Log-Out?", parent=login_window,
icon="warning")
if ask == "yes":
login_window.destroy()
username_entry_user.delete(0, 'end')
username_entry_password_user.delete(0, 'end')
# when login button is pressed on login page
login_window = Toplevel()
login_window.title("Login")
login_window.geometry("1920x1080+-5+-1")
login_window.configure(background="grey92")
# for text label Welcome BAck on the login page
labeled1 = tkinter.LabelFrame(login_window, bd=10, relief="groove", fg="gold", bg="dark blue")
labeled1.place(x=0, y=0, relwidth=1, height=120)
text1_label = tkinter.Label(labeled1, text="\t\t\t\t Welcome", bg="dark blue",
fg="gold",
font=("times new roman", 30, "bold"))
text1_label.grid(row=0, column=0, padx=20, pady=20)
# logout button
logout_button = tkinter.Button(labeled1, image=photos[4], relief="raised", bd=5, command=log_out)
logout_button.place(x=1700, y=25, height=50)
# contact us at bottom of the page
contact_us_frame = tkinter.LabelFrame(login_window, bd=10, relief="groove", bg="dark blue")
contact_us_frame.place(x=0, y=660, height=390, width=1920)
reach_us_label = tkinter.Label(contact_us_frame, bg="dark blue", fg="gold",
text="Reach us at: -\n\nStreet: B-7 Deendayal Nagar, Navghar Road,"
" Mulund (east)\n"
"City: Mumbai "
"State: Maharashtra "
"Zip code: 400081", font=("Caliber", 20, "normal"))
reach_us_label.place(x=10, y=215, height=120, width=820)
photo_label = tkinter.Label(contact_us_frame, image=photos[3])
photo_label.place(x=880, y=230, height=130, width=130)
contact_us_label = tkinter.Label(contact_us_frame, bg="dark blue", fg="gold",
text="Contact us at:-\nLandline: 02225854754\nMobile:"
" +91-855-562-0355\n"
"Email Address:"
" [email protected]", font=("Caliber", 20,
"normal"))
contact_us_label.place(x=1030, y=215, height=120, width=780)
# for requesting half
request_label = tkinter.LabelFrame(login_window, bd=10, relief="groove", fg="gold", bg="dark blue")
request_label.place(x=0, y=120, relwidth=0.5, height=100)
request_label_text = tkinter.Label(request_label, text="\t\tRequest Blood", bg="dark blue", fg="gold",
font=("times new roman", 30, "bold"))
request_label_text.grid(row=0, column=0, padx=20, pady=20)
# for data in requesting half
info_box = tkinter.Label(login_window, bd=10, relief="groove", bg="maroon")
info_box.place(x=0, y=220, relwidth=0.5, height=660)
name = tkinter.Label(info_box, text="Name", bg="maroon", fg="white", font=("times new roman", 22,
"italic"))
name.place(x=10, y=10)
email = tkinter.Label(info_box, text="Email", bg="maroon", fg="white", font=("times new roman", 22,
"italic"))
email.place(x=10, y=70)
phone = tkinter.Label(info_box, text="Contact", bg="maroon", fg="white", font=("times new roman", 22,
"italic"))
phone.place(x=10, y=130)
blood = tkinter.Label(info_box, text="Blood Type", bg="maroon", fg="white", font=("times new roman", 22,
"italic"))
blood.place(x=10, y=190)
requirement = tkinter.Label(info_box, text="Requirement\t\t1 unit = 350ml", bg="maroon", fg="white",
font=("times new roman", 22, "italic"))
requirement.place(x=6, y=250)
name_entry = tkinter.Entry(info_box, relief="sunken", font=("large_font", 15, "normal"))
name_entry.place(x=200, y=15)
mail_entry = tkinter.Entry(info_box, relief="sunken", font=("large_font", 15, "normal"))
mail_entry.place(x=200, y=75)
phone_entry = tkinter.Entry(info_box, relief="sunken", font=("large_font", 15, "normal"))
phone_entry.place(x=200, y=135)
blood_entry = ttk.Combobox(info_box, font=("large_font", 15, "normal"), width=10)
blood_entry['values'] = ('A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-')
blood_entry.place(x=200, y=195)
requirement_entry = Spinbox(info_box, from_=1, to=5, font=("large_font", 15, "normal"), width=10)
requirement_entry.place(x=200, y=255)
# button frame
button_frame1 = Frame(info_box, bd=5, relief="ridge", bg="maroon")
button_frame1.place(x=10, y=460, width=880, height=100)
# buttons in button frame
add_entry = tkinter.Button(button_frame1, text="Add Request", bg="dark blue", fg="white",
relief="raised",
font=("large_font", 15, "bold"), command=on_add)
add_entry.place(x=40, y=22)
delete_entry = tkinter.Button(button_frame1, text="Delete Request", bg="dark blue", fg="white",
relief="raised",
font=("large_font", 15, "bold"), command=on_del)
delete_entry.place(x=250, y=22)
clear_entry = tkinter.Button(button_frame1, text="Clear Request", bg="dark blue", fg="white",
relief="raised",
font=("large_font", 15, "bold"), command=on_clear)
clear_entry.place(x=480, y=22)
requests = tkinter.Button(button_frame1, text="My Requests", bg="dark blue", fg="white",
relief="raised",
font=("large_font", 15, "bold"), command=my_requests)
requests.place(x=690, y=22)
# to show the quantity available of blood
values = tkinter.LabelFrame(info_box, text="Available blood in Bank", bg="maroon", fg="gold",
font=("large_font", 15, "bold"), relief="groove", bd=10)
values.place(x=600, y=10, width=300, height=340)
a_positive = tkinter.Label(values, text=" A +", bg="maroon", fg="gold", font="large_font")
a_positive.place(x=10, y=10)
a_negative = tkinter.Label(values, text=" A -", bg="maroon", fg="gold", font="large_font")
a_negative.place(x=10, y=45)
b_positive = tkinter.Label(values, text=" B +", bg="maroon", fg="gold", font="large_font")
b_positive.place(x=10, y=80)
b_negative = tkinter.Label(values, text=" B -", bg="maroon", fg="gold", font="large_font")
b_negative.place(x=10, y=115)
ab_positive = tkinter.Label(values, text="AB +", bg="maroon", fg="gold", font="large_font")
ab_positive.place(x=10, y=150)
ab_negative = tkinter.Label(values, text="AB -", bg="maroon", fg="gold", font="large_font")
ab_negative.place(x=10, y=185)
o_positive = tkinter.Label(values, text=" O +", bg="maroon", fg="gold", font="large_font")
o_positive.place(x=10, y=220)
o_negative = tkinter.Label(values, text=" O -", bg="maroon", fg="gold", font="large_font")
o_negative.place(x=10, y=255)
a_positive_entry = tkinter.Entry(values, textvariable=a_pos_str, state="disabled",
font=("large_font", 15, "bold"))
a_positive_entry.place(x=100, y=15, width=40)
a_negative_entry = tkinter.Entry(values, textvariable=a_neg_str, state="disabled",
font=("large_font", 15, "bold"))
a_negative_entry.place(x=100, y=50, width=40)
b_positive_entry = tkinter.Entry(values, textvariable=b_pos_str, state="disabled",
font=("large_font", 15, "bold"))
b_positive_entry.place(x=100, y=85, width=40)
b_negative_entry = tkinter.Entry(values, textvariable=b_neg_str, state="disabled",
font=("large_font", 15, "bold"))
b_negative_entry.place(x=100, y=120, width=40)
ab_positive_entry = tkinter.Entry(values, textvariable=ab_pos_str, state="disabled",
font=("large_font", 15, "bold"))
ab_positive_entry.place(x=100, y=155, width=40)
ab_negative_entry = tkinter.Entry(values, textvariable=ab_neg_str, state="disabled",
font=("large_font", 15, "bold"))
ab_negative_entry.place(x=100, y=190, width=40)
o_positive_entry = tkinter.Entry(values, textvariable=o_pos_str, state="disabled",
font=("large_font", 15, "bold"))
o_positive_entry.place(x=100, y=225, width=40)
o_negative_entry = tkinter.Entry(values, textvariable=o_neg_str, state="disabled",
font=("large_font", 15, "bold"))
o_negative_entry.place(x=100, y=260, width=40)
# for donating half
donate_label = tkinter.LabelFrame(login_window, bd=10, relief="groove", bg="dark blue")
donate_label.place(x=(1920/2), y=120, relwidth=0.5, height=100)
donate_label_text = tkinter.Label(donate_label, text="\t\tDonate Blood", bg="dark blue", fg="gold",
font=("times new roman", 30, "bold"))
donate_label_text.place(x=80, y=20)
# for making a label frame inside Donation half
info_box2 = tkinter.Label(login_window, bd=10, relief="groove", bg="maroon")
info_box2.place(x=(1920/2), y=220, relwidth=0.5, height=660)
info_name = tkinter.Label(info_box2, text="Name", bg="maroon", fg="white",
font=("times new roman", 22, "italic"))
info_name.place(x=10, y=10)
info_email = tkinter.Label(info_box2, text="Email", bg="maroon", fg="white",
font=("times new roman", 22, "italic"))
info_email.place(x=10, y=70)
info_phone = tkinter.Label(info_box2, text="Contact", bg="maroon", fg="white",
font=("times new roman", 22, "italic"))
info_phone.place(x=10, y=130)
info_b = tkinter.Label(info_box2, text="Blood Type", bg="maroon", fg="white",
font=("times new roman", 22, "italic"))
info_b.place(x=10, y=190)
info_requirement = tkinter.Label(info_box2, text="Unit\t\t\t1 unit = 350ml", bg="maroon", fg="white",
font=("times new roman", 22, "italic"))
info_requirement.place(x=10, y=250)
info_last_date = tkinter.Label(info_box2, text="Last Donation\t\t (how many months since last "
"donation)",
bg="maroon", fg="white", font=("times new roman", 22, "italic"))
info_last_date.place(x=10, y=310)
info_name_entry = tkinter.Entry(info_box2, relief="sunken", font=("large_font", 15, "normal"))
info_name_entry.place(x=200, y=15)
info_email_entry = tkinter.Entry(info_box2, relief="sunken", font=("large_font", 15, "normal"))
info_email_entry.place(x=200, y=75)
info_phone_entry = tkinter.Entry(info_box2, relief="sunken", font=("large_font", 15, "normal"))
info_phone_entry.place(x=200, y=135)
info_b_entry = ttk.Combobox(info_box2, font=("large_font", 15, "normal"), width=10)
info_b_entry['values'] = ('A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-')
info_b_entry.place(x=200, y=195)
info_requirement_entry = Spinbox(info_box2, from_=1, to=5, font=("large_font", 15, "normal"), width=10)
info_requirement_entry.place(x=200, y=255)
info_last_date_entry = ttk.Combobox(info_box2, font=("large_font", 15, "normal"), width=10)
info_last_date_entry['values'] = ('< 1', '> 3', 'First time donation')
info_last_date_entry.place(x=200, y=315)
# button frame
button_frame2 = Frame(info_box2, bd=5, relief="ridge", bg="maroon")
button_frame2.place(x=20, y=460, width=870, height=100)
# buttons in button frame
info_add_entry = tkinter.Button(button_frame2, text="Add Donation", bg="dark blue", fg="white",
relief="raised",
font=("large_font", 15, "bold"), command=on_donate)
info_add_entry.place(x=40, y=22)
info_delete_entry = tkinter.Button(button_frame2, text="Delete Donation", bg="dark blue", fg="white",
relief="raised", font=("large_font", 15, "bold"), command=on_del2)
info_delete_entry.place(x=250, y=22)
info_clear_entry = tkinter.Button(button_frame2, text="Clear Donation", bg="dark blue", fg="white",
relief="raised",
font=("large_font", 15, "bold"), command=on_clear2)
info_clear_entry.place(x=480, y=22)
info_my_donation = tkinter.Button(button_frame2, text="My Donations", bg="dark blue", fg="white",
relief="raised",
font=("large_font", 15, "bold"), command=my_donations)
info_my_donation.place(x=690, y=22)
break
else:
messagebox.showerror("Error", "Invalid Username or Password!!", parent=mainWindow)
break
# **********************************************************************************************************************
# Below are the functions for admin page
def on_login_admin():
if username_entry_hospital.get() == "Admin" and username_entry_password_hospital.get() == "thisisadmin":
admin_login = Toplevel()
admin_login.geometry("1920x1080+-5+-1")
admin_login.config(bg="maroon")
admin_login.title("Admin Login Page")
# TO ADD welcome bar at the top
labeled_ad = tkinter.LabelFrame(admin_login, bd=10, relief="groove", fg="gold", bg="dark blue")
labeled_ad.place(x=0, y=0, relwidth=1, height=120)
text_ad_label = tkinter.Label(labeled_ad, text="\t\t\t\t Welcome", bg="dark blue", fg="gold",
font=("times new roman", 30, "bold"))
text_ad_label.grid(row=0, column=0, padx=20, pady=20)
# for setting nav bar:-
def on_click_nav():
def on_cross():
nav_root.destroy()
def on_registered_users():
# to destroy admin page once registered users button in navigation bar is pressed
admin_login.destroy()
# to set up registered users page
reg_users_page = Toplevel()
reg_users_page.geometry("1920x1080+-5+-1")
reg_users_page.config(bg="maroon")
reg_users_page.title("Admin Login Page")
# TO ADD welcome bar at the top
labeled_ad1 = tkinter.LabelFrame(reg_users_page, bd=10, relief="groove", fg="gold", bg="dark blue")
labeled_ad1.place(x=0, y=0, relwidth=1, height=120)
text_ad_label1 = tkinter.Label(labeled_ad1, text="\t\t\t\t Registered Users", bg="dark blue",
fg="gold", font=("times new roman", 30, "bold"))
text_ad_label1.grid(row=0, column=0, padx=20, pady=20)
def on_click_nav2():
def on_cross2():
nav_root2.destroy()
def on_registered_users2():
reg_users_page.destroy()
on_registered_users()
def on_home2():
reg_users_page.destroy()
on_login_admin()
def on_queries2():
reg_users_page.destroy()
on_queries()
def on_user_activity2():
reg_users_page.destroy()
on_user_activity()
# Setting Navbar frame:
nav_root2 = tkinter.Frame(reg_users_page, bg="grey", height=1000, width=700, bd=20)
nav_root2.place(x=30, y=30)
# Close nav bar photo