-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank_management_systm.py
1000 lines (983 loc) · 61.1 KB
/
Bank_management_systm.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
# ==================================importing package===================================
import sqlite3
from tkinter import *
from tkinter import messagebox
import datetime
#====================================== global Variable========================================
#==================== various 48 background color==============================================
bg_cl=['#fc0303','#fc2403','#fc4503','#fc6703','#fc8003','#ff8100','#fcb503', '#fcc603','#fcdf03','#fcf003',
'#e3fc03','#befc03', '#a9fc03','#90fc03','#73fc03','#41fc03','#2dfc03','#07fc03','#03fc14','#03fc28',
'#03fc41','#03fc56','#03fc77','#03fc98','#03fcbe','#03fcdb','#03fcf4','#03e3fc','#03bafc','#039dfc',
'#0384fc','#0373fc','#0356fc','#033dfc','#0324fc','#2003fc','#5203fc','#8003fc','#a503fc','#c603fc','#df03fc',
'#fc03f4','#fc03d2','#fc03b5','#fc0384','#fc035e','#fc0339','#fc0320']
#==================== various 48 foreground color==============================================
fg_cl=['#4d0000','#400a01','#3d1000','#421b01','#4f2800','#4a2500','#4f3902','#473801','#473f01','#474401',
'#454d02','#283601','#223301','#244001','#1a3801','#114500','#0b3d01','#023d01','#013604','#014d0c',
'#004712','#003010','#003318','#00331f','#013b2c','#002621','#003b39','#00272b','#002533','#00263d',
'#00203d','#001836','#001745','#010f3d','#00062e','#060036','#13003d','#1d003b','#200030','#360145','#2b0130',
'#3b0039','#38002f','#380028','#38001d','#400017','#42000e','#380007']
c_p=0
main_vv=True
menu_vv=True
adnt_vv=True
with_vv=True
animation=False
#=================================== function that return account type==================================
def account_type(n): # A Global Funtion
if n==1:
return('Saving Account')
elif n==2:
return('Current Account')
elif n==3:
return('Fixed for 1 year')
elif n==4:
return('Fixed for 2 year')
elif n==5:
return('Fixed for 3 year')
# =================================== -:-:- Close Account window -:-:-================================
def close_ac(animation):
def set_default_color():# it will reset the animation to default
c_acnt.config(bg ='#c7ffff');l_1.config(bg ='#c7ffff',fg='#06088f')
l_2.config(bg ='#c7ffff',fg='#06088f');bal.config(bg ='#c7ffff',fg='#06088f')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
back.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
a_num.config(bg='white',fg='black')
m_2.config(bg ='#c7ffff',fg='#06088f')
m_2.place(x=340,y=80)
def switch_color(): # it will Activate the Animation
if (a_var.get())==1:
global c_p,with_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p];fg_c=fg_cl[c_p]
c_acnt.config(bg=bg_c);
l_1.config(bg=bg_c,fg=fg_c);l_2.config(bg=bg_c,fg=fg_c);bal.config(bg=bg_c,fg=fg_c)
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
back.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
a_num.config(bg=fg_c,fg=bg_c)
c_p+=1
if with_vv:
m_2.place_forget()
with_vv=False
else:
m_2.place(x=340,y=80)
m_2.config(bg=bg_c,fg='white')
with_vv=True
root.after(500,switch_color) # it will invoke in every .25 second
else:
root.after_cancel(switch_color)
set_default_color()
def close():
if ac_var.get()=='':
messagebox.showerror("unable to get account number","Please Fill Your account number")
else:
cur=db.cursor()
cur.execute(f"select name,money from bank_management_system where Account_no={int(ac_var.get())}")
row=cur.fetchone()
if not row:
messagebox.showerror("Account Nor Exist ",f"{ac_var.get()} account number not available in our bank")
else:
n=messagebox.askquestion("Confirm To Close Account",f"Are You Sure to Close Account : {ac_var.get()}",icon='warning')
if n=='yes':
chk.place_forget()
a_num.config(state=DISABLED)
a_num.config(width=35)
bal.place(x=250,y=250)
db.execute(f"delete from bank_management_system where Account_no={int(ac_var.get())}")
db.commit()
db.total_changes
s=str(row[0])+' Your Account number : '+ac_var.get()+' has been Closed!!!'
bal_s.set(s)
else:
ac_var.set('')
# ========================:-:-:-:-:- Close Window will Start from Here-:-:-:-:-:-:-==========================
root.title('Close Account')# setting title
c_acnt=Frame(root,height='500',width='900',bg ='#c7ffff')
c_acnt.place(x=0,y=0)
ac_var=StringVar()
bal_s=StringVar();a_var=IntVar()
l_1=Label(c_acnt,text ='ROYAL BANK OF INDIA',cursor='Arrow',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 28))
l_1.place(x=250,y=20)
m_2=Label(c_acnt,text ='''World's Biggest Bank''',cursor='Heart',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 18))
m_2.place(x=340,y=80)
a_c=Checkbutton(c_acnt,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',font=("Arial Bold", 10),activebackground='#c7ffff',
activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
l_2=Label(c_acnt,text = 'Enter Account Number:',bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
l_2.place(x=60,y=180)
a_num=Entry(c_acnt,textvariable=ac_var,bd = 1,font=("Times New Roman", 16),fg = '#06088f')
a_num.place(x=320,y=180)
chk=Button(c_acnt,text='Close Account',bd=1,font=("Times New Roman Bold",10),command=close,width='12',bg='red',fg='#c7ffff',
activebackground='yellow',activeforeground='red')
chk.place(x=600,y=180)
bal=Label(c_acnt,textvariable=bal_s,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
back=Button(c_acnt,text='Back',font=("Arial Bold",12),width='10',bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black'
,command=(lambda: c_acnt.place_forget() or menu(a_var.get())))
back.place(x=600,y=390)
if animation:
a_var.set(1)
switch_color()
animation=0
# =================================== -:-:- Modified Account window -:-:-================================
def mod_window(animation):
def set_default_color():
mod_ac.config(bg ='#c7ffff');
l_1.config(bg ='#c7ffff',fg='#06088f');l_2.config(bg ='#c7ffff',fg='#06088f')
l_3.config(bg ='#c7ffff',fg='#06088f');l_4.config(bg ='#c7ffff',fg='#06088f')
l_5.config(bg ='#c7ffff',fg='#06088f');l_6.config(bg ='#c7ffff',fg='#06088f')
l_7.config(bg ='#c7ffff',fg='#06088f');l_8.config(bg ='#c7ffff',fg='#06088f')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk_1.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk_2.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk_3.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk_4.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk_5.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk_6.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
back.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
update.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
valid.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
name.config(bg='white',fg='black')
dob.config(bg='white',fg='black')
address.config(bg='white',fg='black')
ac_no.config(bg='white',fg='black')
phone_no.config(bg='white',fg='black')
m_2.config(bg ='#c7ffff',fg='#06088f')
m_2.place(x=340,y=60)
def switch_color():
if (a_var.get())==1:
global c_p,with_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p];fg_c=fg_cl[c_p]
mod_ac.config(bg=bg_c);
l_1.config(bg=bg_c,fg=fg_c);l_2.config(bg=bg_c,fg=fg_c);l_3.config(bg=bg_c,fg=fg_c);l_4.config(bg=bg_c,fg=fg_c)
l_5.config(bg=bg_c,fg=fg_c);l_6.config(bg=bg_c,fg=fg_c);l_7.config(bg=bg_c,fg=fg_c);l_8.config(bg=bg_c,fg=fg_c)
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk_1.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk_2.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk_3.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk_4.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk_5.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk_6.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
back.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
update.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
valid.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
name.config(bg=fg_c,fg=bg_c)
dob.config(bg=fg_c,fg=bg_c)
address.config(bg=fg_c,fg=bg_c)
phone_no.config(bg=fg_c,fg=bg_c)
ac_no.config(bg=fg_c,fg=bg_c)
c_p+=1
if with_vv:
m_2.place_forget()
with_vv=False
else:
m_2.place(x=340,y=60)
m_2.config(bg=bg_c,fg='white')
with_vv=True
root.after(500,switch_color)
else:
root.after_cancel(switch_color)
set_default_color()
def checkdob():
if mdob_var.get()=='':
return True
else:
try:
datetime.datetime.strptime(mdob_var.get(),"%d/%m/%Y")
except ValueError:
return True
else:
return False
def check_mob():
if mphone_var.get()=='' or len(mphone_var.get())!=10:
return True
else:
try:
int(mphone_var.get())
except ValueError:
return True
else:
return False
def update():
if confirm_var.get()==0:
messagebox.showerror(" Please Agree","You can not update untill you agree")
elif mname_var.get()=='':
messagebox.showerror("Name is empty!!!","Please Fill your name !! ")
elif checkdob():
messagebox.showerror("Enter correct Date of Birth "," Example- 01/01/2000 ")
elif maddr_var.get()=='':
messagebox.showerror("Address is Empty ","Please Fill Correct Address")
elif check_mob():
messagebox.showerror("Wrong Mobile Number!!","Please Fill Correct 10 Digit Mobile Number ")
elif t_var.get()==0:
messagebox.showerror("Type Of Account not Avilable !!","Please Choose one of the Account Type!!")
else:
db.execute("update bank_management_system set name=?,date_of_birth=?,account_type=?,address=?,mobile_no=? where Account_no=?"
,(mname_var.get(),mdob_var.get(),account_type(t_var.get()),maddr_var.get(),mphone_var.get(),int(mac_var.get())))
db.commit()
db.total_changes
messagebox.showinfo("$$congratulation!!!", "Account Updated successfully")
mod_ac.place_forget()
mod_window(a_var.get())
def activate_button():
l_3.place(x=80,y=170)
l_4.place(x=80,y=220)
name.place(x=300,y=220)
l_5.place(x=80,y=260)
dob.place(x=300,y=260)
l_6.place(x=80,y=300)
address.place(x=300,y=300)
l_7.place(x=80,y=340)
phone_no.place(x=300,y=340)
l_8.place(x=590,y=180)
chk_1.place(x=580,y=220)
chk_2.place(x=580,y=250)
chk_3.place(x=580,y=280)
chk_4.place(x=580,y=310)
chk_5.place(x=580,y=340)
chk_6.place(x=80,y=390)
update.place(x=80,y=435)
def validate():
try:
account_no=int(mac_var.get())
except ValueError:
messagebox.showerror("Account Not Readable","Please fill the correct account by using Digit ")
else:
cur=db.cursor()
cur.execute(f"select name from bank_management_system where Account_no={int(mac_var.get())}")
row=cur.fetchone()
if not row:
messagebox.showerror("Account Nor Exist ",f"{mac_var.get()} account number not available in our bank")
else:
valid.place_forget()
ac_no.config(state=DISABLED,width=40)
activate_button()
#=====================-:-:-:-:-:-:- mod window will start from here -:-:-:-:-:-:-=====================
mod_ac=Frame(root,height='500',width='900',bg ='#c7ffff')
mod_ac.place(x=0,y=0)
a_var=IntVar();confirm_var=IntVar();t_var=IntVar()
mac_var=StringVar();mname_var=StringVar();maddr_var=StringVar()
mdob_var=StringVar();mphone_var=StringVar()
root.title('Modified the Account')# setting title
l_1=Label(mod_ac,text ='ROYAL BANK OF INDIA',cursor='Arrow',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 28))
l_1.place(x=250,y=15)
m_2=Label(mod_ac,text ='''World's Biggest Bank''',cursor='Heart',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 18))
m_2.place(x=340,y=60)
a_c=Checkbutton(mod_ac,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',font=("Arial Bold", 10),activebackground='#c7ffff',
activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
l_2=Label(mod_ac,text='Enter Your Account Number:',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
l_2.place(x=80,y=120)
ac_no=Entry(mod_ac,bd=1,width='33',textvariable=mac_var,bg='White',font = ('Times New Roman', 16))
ac_no.place(x=340,y=120)
valid=Button(mod_ac,text='Validate',width='7',bg ='red',fg='white',font = ('Times New Roman', 10),command=validate,
activebackground='red',activeforeground='yellow')
valid.place(x=720,y=120)
l_3=Label(mod_ac,text='Enter Modified Details:',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
l_4=Label(mod_ac,text = 'Enter name:-',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
name=Entry(mod_ac,bd = 1,textvariable=mname_var,font = ('Times New Roman', 14))
l_5=Label(mod_ac,text='Enter DOB dd/mm/yyyy:-',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
dob=Entry(mod_ac,textvariable=mdob_var,bd=1,font = ('Times New Roman', 14))
l_6=Label(mod_ac,text = 'Enter Address:-',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
address=Entry(mod_ac,bd = 1,textvariable=maddr_var,font = ('Times New Roman', 14))
l_7=Label(mod_ac,text = 'Enter Phone no:-',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
phone_no=Entry(mod_ac,textvariable=mphone_var,bd = 1,font = ('Times New Roman', 14))
l_8=Label(mod_ac,text='Type of Account',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 16))
chk_1=Checkbutton(mod_ac,text='Saving Account:-',variable=t_var,onvalue=1,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
chk_2=Checkbutton(mod_ac,text='Current Account:-',variable=t_var,onvalue=2,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
chk_3=Checkbutton(mod_ac,text='Fixed1(for 1 year):-',variable=t_var,onvalue=3,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
chk_4=Checkbutton(mod_ac,text='Fixed2(for 2 year):-',variable=t_var,onvalue=4,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
chk_5=Checkbutton(mod_ac,text='Fixed3(for 3 year):-',variable=t_var,onvalue=5,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
chk_6=Checkbutton(mod_ac,text='Please confirm ! if you fill all information correctly !',variable=confirm_var,onvalue=1,
bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
update=Button(mod_ac,text='Update',bg ='red',fg='white',font = ('Times New Roman', 14),command=update,
width=15,activebackground='red',activeforeground='yellow')
back=Button(mod_ac,text='back',width='10',bg ='red',fg='white',font = ('Times New Roman', 14),
command=(lambda: mod_ac.place_forget() or menu(a_var.get())),
activebackground='red',activeforeground='yellow')
back.place(x=680,y=435)
if animation:
a_var.set(1)
animation=0
switch_color()
# =================================== -:-:- All Account Holder List window -:-:-================================
def show_detail(animation):
def set_default_color():
s_det.config(bg ='#c7ffff');
l_1.config(bg ='#c7ffff',fg='#06088f');l_2.config(bg ='#c7ffff',fg='#06088f');bal_1.config(bg ='#c7ffff',fg='#06088f')
bal_2.config(bg ='#c7ffff',fg='#06088f');bal_3.config(bg ='#c7ffff',fg='#06088f');bal_4.config(bg ='#c7ffff',fg='#06088f')
bal_5.config(bg ='#c7ffff',fg='#06088f');bal_6.config(bg ='#c7ffff',fg='#06088f');bal_7.config(bg ='#c7ffff',fg='#06088f')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
back.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
a_num.config(bg='white',fg='black')
m_2.config(bg ='#c7ffff',fg='#06088f')
m_2.place(x=340,y=80)
def switch_color():
if (a_var.get())==1:
global c_p,with_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p];fg_c=fg_cl[c_p]
s_det.config(bg=bg_c);
l_1.config(bg=bg_c,fg=fg_c);l_2.config(bg=bg_c,fg=fg_c);bal_1.config(bg=bg_c,fg=fg_c)
bal_2.config(bg=bg_c,fg=fg_c);bal_3.config(bg=bg_c,fg=fg_c);bal_4.config(bg=bg_c,fg=fg_c)
bal_5.config(bg=bg_c,fg=fg_c);bal_6.config(bg=bg_c,fg=fg_c);bal_7.config(bg=bg_c,fg=fg_c)
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
back.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
a_num.config(bg=fg_c,fg=bg_c)
c_p+=1
if with_vv:
m_2.place_forget()
with_vv=False
else:
m_2.place(x=340,y=80)
m_2.config(bg=bg_c,fg='white')
with_vv=True
root.after(500,switch_color)
else:
root.after_cancel(switch_color)
set_default_color()
def show_detail():
if ac_var.get()=='':
messagebox.showerror("unable to get account number","Please Fill Your account number")
else:
cur=db.cursor()
cur.execute(f"select * from bank_management_system where Account_no={int(ac_var.get())}")
row=cur.fetchone()
if not row:
messagebox.showerror("Account Nor Exist ",f"{ac_var.get()} account number not available in our bank")
else:
chk.place_forget()
a_num.config(state=DISABLED)
a_num.config(width=35)
bv_1.set(f'Name:{str(row[1])}');bal_1.place(x=60,y=220)
bv_2.set(f'Gender:{str(row[2])}');bal_2.place(x=60,y=250)
bv_3.set(f'Date Of Birth:{str(row[3])}');bal_3.place(x=60,y=280)
bv_4.set(f'Account Type:{str(row[4])}');bal_4.place(x=60,y=310)
bv_5.set(f'Mobile No:{str(row[5])}');bal_5.place(x=60,y=340)
bv_6.set(f'Address:{str(row[6])}');bal_6.place(x=60,y=370)
bv_7.set(f'Balance:{str(row[7])} $');bal_7.place(x=60,y=400)
s_det=Frame(root,height='500',width='900',bg ='#c7ffff')
s_det.place(x=0,y=0)
a_var=IntVar()
ac_var=StringVar()
bv_1=StringVar();bv_2=StringVar();bv_3=StringVar();bv_4=StringVar();bv_5=StringVar();bv_6=StringVar();bv_7=StringVar()
root.title('Detail Window') # setting title
l_1=Label(s_det,text ='ROYAL BANK OF INDIA',cursor='Arrow',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 28))
l_1.place(x=250,y=20)
m_2=Label(s_det,text ='''World's Biggest Bank''',cursor='Heart',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 18))
m_2.place(x=340,y=80)
a_c=Checkbutton(s_det,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',font=("Arial Bold", 10),activebackground='#c7ffff',
activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
l_2=Label(s_det,text = 'Enter Account Number:',bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
l_2.place(x=60,y=180)
a_num=Entry(s_det,textvariable=ac_var,bd = 1,font=("Times New Roman", 16),fg = '#06088f')
a_num.place(x=320,y=180)
chk=Button(s_det,text='Show Detail',bd=1,font=("Times New Roman Bold",10),command=show_detail,
width='12',bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='red')
chk.place(x=600,y=180)
bal_1=Label(s_det,textvariable=bv_1,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
bal_2=Label(s_det,textvariable=bv_2,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
bal_3=Label(s_det,textvariable=bv_3,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
bal_4=Label(s_det,textvariable=bv_4,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
bal_5=Label(s_det,textvariable=bv_5,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
bal_6=Label(s_det,textvariable=bv_6,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
bal_7=Label(s_det,textvariable=bv_7,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
back=Button(s_det,text='Back',width='13',bg ='red',fg='white',font = ('Times New Roman', 14)
,command=(lambda: s_det.place_forget() or menu(a_var.get())),activebackground='red',activeforeground='yellow')
back.place(x=680,y=435)
if animation:
a_var.set(1)
animation=0
switch_color()
# =================================== -:-:- Balance Enquiry Window -:-:-================================
def check_bal(animation):
def set_default_color():
bal_en.config(bg ='#c7ffff');l_1.config(bg ='#c7ffff',fg='#06088f')
l_2.config(bg ='#c7ffff',fg='#06088f');bal.config(bg ='#c7ffff',fg='#06088f')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
chk.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
back.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
a_num.config(bg='white',fg='black')
m_2.config(bg ='#c7ffff',fg='#06088f')
m_2.place(x=340,y=80)
def switch_color():
if (a_var.get())==1:
global c_p,with_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p];fg_c=fg_cl[c_p]
bal_en.config(bg=bg_c);l_1.config(bg=bg_c,fg=fg_c)
l_2.config(bg=bg_c,fg=fg_c);bal.config(bg=bg_c,fg=fg_c)
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
chk.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
back.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
a_num.config(bg=fg_c,fg=bg_c)
c_p+=1
if with_vv:
m_2.place_forget()
with_vv=False
else:
m_2.place(x=340,y=80)
m_2.config(bg=bg_c,fg='white')
with_vv=True
root.after(500,switch_color)
else:
root.after_cancel(switch_color)
set_default_color()
def check():
if ac_var.get()=='':
messagebox.showerror("unable to get account number","Please Fill Your account number")
else:
cur=db.cursor()
cur.execute(f"select name,money from bank_management_system where Account_no={int(ac_var.get())}")
row=cur.fetchone()
if not row:
messagebox.showerror("Account Nor Exist ",f"{ac_var.get()} account number not available in our bank")
else:
chk.place_forget()
a_num.config(state=DISABLED)
a_num.config(width=35)
bal.place(x=250,y=250)
s=str(row[0])+' Your Balance is: '+str(row[1])+' $'
bal_s.set(s)
root.title('Balance Enquiry')# setting title
bal_en=Frame(root,height='500',width='900',bg ='#c7ffff')
bal_en.place(x=0,y=0)
ac_var=StringVar()
bal_s=StringVar();a_var=IntVar()
l_1=Label(bal_en,text ='ROYAL BANK OF INDIA',cursor='Arrow',bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman Bold', 28))
l_1.place(x=250,y=20)
m_2=Label(bal_en,text ='''World's Biggest Bank''',cursor='Heart',bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman Bold', 18))
m_2.place(x=340,y=80)
a_c=Checkbutton(bal_en,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',
font=("Arial Bold", 10),activebackground='#c7ffff',activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
l_2=Label(bal_en,text = 'Enter Account Number:',bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
l_2.place(x=60,y=180)
a_num=Entry(bal_en,textvariable=ac_var,bd = 1,font=("Times New Roman", 16),fg = '#06088f')
a_num.place(x=320,y=180)
chk=Button(bal_en,text='Check Balance',bd=1,font=("Times New Roman Bold",10),command=check,
width='12',bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='red')
chk.place(x=600,y=180)
bal=Label(bal_en,textvariable=bal_s,bg='#c7ffff',fg='#06088f',font=("Times New Roman", 16))
back=Button(bal_en,text='Back',font=("Arial Bold",12),width='10',bg='red',fg='#c7ffff',activebackground='yellow',
activeforeground='black',command=(lambda: bal_en.place_forget() or menu(a_var.get())))
back.place(x=600,y=390)
if animation:
a_var.set(1)
switch_color()
animation=0
# =================================== -:-:- Withdraw Window -:-:-================================
def withdraw(animation):
def set_default_color():
dpst.config(bg='#c7ffff');
name.config(fg='black',bg='white');pin.config(fg='black',bg='white');d_amnt.config(fg='black',bg='white')
b_1.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
b_2.config(bg='red',fg='#c7ffff',activebackground='yellow',activeforeground='black')
l_1.config(bg ='#c7ffff',fg='#06088f');l_2.config(bg ='#c7ffff',fg='#06088f')
l_3.config(bg ='#c7ffff',fg='#06088f');l_4.config(bg ='#c7ffff',fg='#06088f');var_l.config(bg ='navy',fg='white')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
r_1.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
r_2.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
m_2.place(x=340,y=80)
m_2.config(bg ='#c7ffff',fg='#06088f')
def switch_color():
if (a_var.get())==1:
global c_p,with_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p];fg_c=fg_cl[c_p]
dpst.config(bg=bg_c);name.config(fg=bg_c,bg=fg_c)
pin.config(fg=bg_c,bg=fg_c);d_amnt.config(fg=bg_c,bg=fg_c)
b_1.config(bg=fg_c,fg=bg_c,activeforeground='white',activebackground=fg_c)
b_2.config(bg=fg_c,fg=bg_c,activeforeground='white',activebackground=fg_c)
l_1.config(bg=bg_c,fg=fg_c);l_2.config(bg=bg_c,fg=fg_c)
l_3.config(bg=bg_c,fg=fg_c);l_4.config(bg=bg_c,fg=fg_c);var_l.config(bg='white',fg=fg_c)
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='White')
r_1.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
r_2.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_p+=1
if with_vv:
m_2.place_forget()
with_vv=False
else:
m_2.place(x=340,y=80)
m_2.config(bg=bg_c,fg='white')
with_vv=True
root.after(500,switch_color)
else:
root.after_cancel(switch_color)
set_default_color()
def debit():
if amnt_var.get()=='':
messagebox.showerror("Ammount Not fill ","Please Fill Your Ammount")
else:
cur=db.cursor()
cur.execute(f"select money from bank_management_system where Account_no={int(pin.get())}")
row=cur.fetchone()
if t_var.get()==1:
if int(amnt_var.get())<int(row[0]):
m=(str(int(row[0])-int(amnt_var.get())))
amnt_var.set('')
db.execute("update bank_management_system set money=? where Account_no=?",(m,pin.get()))
db.commit()
db.total_changes
messagebox.showinfo("Deposited successfully",f"Blance Left : {amnt_var.get()} in your account")
dpst.place_forget()
withdraw(a_var.get())
else:
messagebox.showerror("Ammount is too High",f"Your Current ammount is :{int(row[0])}")
elif t_var.get()==2:
m=(int(row[0])+int(amnt_var.get()))
amnt_var.set('')
db.execute("update bank_management_system set money=? where Account_no=?",(m,pin.get()))
db.commit()
db.total_changes
messagebox.showinfo("Creditted successfully",f"Blance Left : {m} in your account")
dpst.place_forget()
withdraw(a_var.get())
def show_b():
if t_var.get()==1:
b_1.place(x=105,y=410)
b_1.config(text='Deposite')
elif t_var.get()==2:
b_1.place(x=105,y=410)
b_1.config(text='Credit')
def varify_acnt():
if pin.get()=='':
messagebox.showerror("Account Number not correct",'pleasen fill your account number not available in our bank')
return
cur=db.cursor()
cur.execute(f"select name from bank_management_system where Account_no={int(pin.get())}")
row=cur.fetchone()
if not row:
messagebox.showerror("Account Nor Exist ",f"{pin.get()} account number not available in our bank")
elif str(row[0])==name_var.get():
name.config(state=DISABLED)
pin.config(state=DISABLED)
r_1.place(x=130,y=270)
r_2.place(x=400,y=270)
l_4.place(x=100,y=320)
d_amnt.place(x=360,y=320)
v_1.place_forget()
var_l.place(x=600,y=223)
else:
if name_var.get()=='':
messagebox.showerror("Name not available"," Please Fill Your Appropriate Name")
else:
messagebox.showerror("Not Found"," Name does not matched with existing account number!")
# ======================= Creating frame=========================
dpst=Frame(root,height='500',width='900',bg ='#c7ffff')
dpst.place(x=0,y=0)
name_var=StringVar()
acn_var=StringVar()
amnt_var=StringVar()
at_var=IntVar();t_var=IntVar();a_var=IntVar()
root.title('Withdraw/Credit') #settung the title
l_1=Label(dpst,text ='ROYAL BANK OF INDIA',cursor='Arrow',bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman Bold', 28))
l_1.place(x=250,y=20)
m_2=Label(dpst,text ='''World's Biggest Bank''',cursor='Heart',bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman Bold', 18))
m_2.place(x=340,y=80)
a_c=Checkbutton(dpst,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',
font=("Arial Bold", 10),activebackground='#c7ffff',activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
l_2=Label(dpst,text = 'Enter Account Holder Name:-',bg='#c7ffff',fg='#06088f',font=("Arial ", 14))
l_2.place(x=100,y=150)
name=Entry(dpst,textvariable=name_var,bd = 3,font=("Arial ", 14),fg = '#06088f')
name.place(x=360,y=150)
l_3=Label(dpst,text='Enter the Account no:-',bg='#c7ffff',fg='#06088f',font=("Arial ", 14))
l_3.place(x=100,y=220)
pin=Entry(dpst,textvariable=acn_var,bd=3,fg='#06088f',font=("Arial ", 14))
pin.place(x=360,y=220)
v_1=Button(dpst,text='Varify',font=("Arial Bold",8),command=varify_acnt,width='8',bg='black',
fg='white',activebackground='white',activeforeground='black')
v_1.place(x=600,y=221)
r_1=Radiobutton(dpst,text='Deposite',variable=t_var,value=1,command=show_b,bg='#c7ffff',fg='#06088f',
font=("Arial Bold", 12),activebackground='#c7ffff',activeforeground='red')
r_2=Radiobutton(dpst,text='Credit',variable=t_var,value=2,command=show_b,bg='#c7ffff',
fg='#06088f',font=("Arial Bold", 12),activebackground='#c7ffff',activeforeground='red')
l_4=Label(dpst,text = 'Enter Amount:-',bg='#c7ffff',fg='#06088f',font=("Arial ", 14))
d_amnt=Entry(dpst,textvariable=amnt_var,bd = 3,font=("Arial ", 14),fg ='#06088f')
b_1=Button(dpst,font=("Arial Bold",12),command=debit,width='10',bg='red',fg='#c7ffff',
activebackground='yellow',activeforeground='black')
b_2=Button(dpst,text='Back',font=("Arial Bold",12),width='10',bg='red',fg='#c7ffff',
activebackground='yellow',activeforeground='black',command=(lambda: dpst.place_forget() or menu(a_var.get())))
b_2.place(x=700,y=410)
var_l=Label(dpst,text='Verified',bg='navy',fg='white',font=("Arial Bold", 10))
if animation:
a_var.set(1)
switch_color()
animation=0
# ============================== -:-:- Add New Account Window -:-:-==============================
def add_new_account(animation):
def set_default_color():
add_acnt.config(bg='#c7ffff');m_2.config(bg='#c7ffff',fg='#06088f');m_2.place(x=340,y=65)
amnt_e.config(fg='black',bg='white');phone_no.config(fg='black',bg='white')
addr.config(fg='black',bg='white');dob.config(fg='black',bg='white')
name.config(fg='black',bg='white')
b_1.config(bg ='red',fg='white',activebackground='red',activeforeground='yellow')
b_2.config(bg ='red',fg='white',activebackground='red',activeforeground='yellow')
l_1.config(bg='#c7ffff',fg='#06088f');l_2.config(bg='#c7ffff',fg='#06088f')
l_3.config(bg='#c7ffff',fg='#06088f');l_4.config(bg='#c7ffff',fg='#06088f')
l_5.config(bg='#c7ffff',fg='#06088f');l_6.config(bg='#c7ffff',fg='#06088f')
l_7.config(bg='#c7ffff',fg='#06088f');l_8.config(bg='#c7ffff',fg='#06088f')
r_1.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
r_2.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
c_1.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
c_2.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
c_3.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
c_4.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
c_5.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
c_6.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
def switch_color():
if (a_var.get())==1:
global c_p,adnt_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p];fg_c=fg_cl[c_p]
add_acnt.config(bg=bg_c);
amnt_e.config(fg=bg_c,bg=fg_c);phone_no.config(fg=bg_c,bg=fg_c);addr.config(fg=bg_c,bg=fg_c)
dob.config(fg=bg_c,bg=fg_c);name.config(fg=bg_c,bg=fg_c)
b_1.config(bg=fg_c,fg=bg_c,activeforeground='white',activebackground=fg_c)
b_2.config(bg=fg_c,fg=bg_c,activeforeground='white',activebackground=fg_c)
l_1.config(bg=bg_c,fg=fg_c);l_2.config(bg=bg_c,fg=fg_c);l_3.config(bg=bg_c,fg=fg_c)
l_4.config(bg=bg_c,fg=fg_c);l_5.config(bg=bg_c,fg=fg_c);l_6.config(bg=bg_c,fg=fg_c)
l_7.config(bg=bg_c,fg=fg_c);l_8.config(bg=bg_c,fg=fg_c)
r_1.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
r_2.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_1.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_2.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_3.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_4.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_5.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_6.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_p+=1
if adnt_vv:
m_2.place_forget()
adnt_vv=False
else:
m_2.place(x=340,y=65)
m_2.config(bg=bg_c,fg='white')
adnt_vv=True
root.after(500,switch_color)
else:
root.after_cancel(switch_color)
set_default_color()
def get_gender(n):
if n==1:
return 'male'
else:
return 'female'
def vary_mob():
if no_var.get()=='' or len(no_var.get())!=10:
return True
else:
try:
int(no_var.get())
except ValueError:
return Tru
else:
return False
def vary_dob():
if db_var.get()=='':
return True
else:
try:
datetime.datetime.strptime(db_var.get(),"%d/%m/%Y")
except ValueError:
return True
else:
return False
def create_acnt():
if c_var.get()==0:
messagebox.showerror("Unable to Create New Account","Please Agree the Our Term and Conditon!!!")
elif name_var.get()=='':
messagebox.showerror("Unable to Create New Account","Please Fill Your Name!!")
elif g_var.get()==0:
messagebox.showerror("Unable to Create New Account","Please Select Your Gender!!")
elif vary_dob():
messagebox.showerror("Enter a Valid Date Of Birth","Example- 01/01/2000")
elif address_var.get()=='':
messagebox.showerror("Unable to Create New Account","Please Enter Address!!")
elif vary_mob():
messagebox.showerror("Wrong Mobile Number","Mobile Number Should Be 10 Digit!!")
elif amnt_var.get()=='':
messagebox.showerror("Unable to Create New Account","Please Enter Deposite Ammount!!")
elif at_var.get()==0:
messagebox.showerror("Unable to Create New Account","Please Select Account Type!!")
else:
db.execute('insert into bank_management_system (name,gender,date_of_birth,account_type,mobile_no,address,money) \
values (?,?,?,?,?,?,?)',
(name_var.get(),get_gender(g_var.get()),db_var.get(),account_type(at_var.get()),no_var.get(),address_var.get(),int(amnt_var.get())));
db.commit()
cursor=db.execute('select max(Account_no) from bank_management_system')
ac_no=cursor.fetchone()[0]
messagebox.showinfo(f"Congratulation {name_var.get()} !!!!", "Account Has Been Created successfully")
messagebox.showinfo(f"Congratulation {name_var.get()} !!!!", f"Your Account Number is : {ac_no}")
add_acnt.place_forget()
add_new_account(a_var.get())
# ============ Declaration of Variables==================================
at_var=IntVar();g_var=IntVar();name_var=StringVar();db_var=StringVar();a_var=IntVar()
address_var=StringVar();no_var=StringVar();amnt_var=StringVar();c_var=IntVar();
# ======================= Creating Add New Account window===============
root.title('add account') #setting title
add_acnt= Frame(root,height='500',width='900',bg ='#c7ffff')
add_acnt.place(x=0,y=0)
l_1=Label(add_acnt,text ='ROYAL BANK OF INDIA',cursor='Arrow',bg ='#c7ffff',
fg='#06088f',font = ('Times New Roman Bold', 28))
l_1.place(x=250,y=15)
m_2=Label(add_acnt,text ='''World's Biggest Bank''',cursor='Heart',bg ='#c7ffff',
fg='#06088f',font = ('Times New Roman Bold', 18))
m_2.place(x=340,y=65)
a_c=Checkbutton(add_acnt,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',font=("Arial Bold", 10),
activebackground='#c7ffff',activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
l_2=Label(add_acnt,text="""Enter Your Account Holder's Name:-""",bg ='#c7ffff',
fg='#06088f',font = ('Times New Roman', 16))
l_2.place(x=60,y=120)
name=Entry(add_acnt,bd=1,textvariable=name_var,width='40',bg='White',font = ('Times New Roman', 16))
name.place(x=410,y=120)
l_3=Label(add_acnt,text='Gender:',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
l_3.place(x=60,y=170)
r_1=Radiobutton(add_acnt,text='Male',variable=g_var, value=1,bg ='#c7ffff',fg='#06088f'
,font = ('Times New Roman', 16),activebackground='#c7ffff',activeforeground='red')
r_1.place(x=180,y=170)
r_2=Radiobutton(add_acnt,text='Female',variable=g_var,value=2,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 16),activebackground='#c7ffff',activeforeground='red')
r_2.place(x=300,y=170)
l_4=Label(add_acnt,text = 'DOB (dd/mm/yyyy):-',bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 16))
l_4.place(x=60,y=220)
dob=Entry(add_acnt,textvariable=db_var,bd = 1,font = ('Times New Roman', 14))
dob.place(x=300,y=220)
l_5=Label(add_acnt,text='Enter Address:-',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
l_5.place(x=60,y=260)
addr=Entry(add_acnt,textvariable=address_var,bd=1,font = ('Times New Roman', 14))
addr.place(x=300,y=260)
l_6=Label(add_acnt,text = 'Enter Phone no:-',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
l_6.place(x=60,y=300)
phone_no=Entry(add_acnt,textvariable=no_var,bd = 1,font = ('Times New Roman', 14))
phone_no.place(x=300,y=300)
l_7=Label(add_acnt,text = 'Enter Amount to deposit:-',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 16))
l_7.place(x=60,y=340)
amnt_e=Entry(add_acnt,textvariable=amnt_var,bd = 1,font = ('Times New Roman', 14))
amnt_e.place(x=300,y=340)
l_8=Label(add_acnt,text='Type of Account',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 16))
l_8.place(x=600,y=180)
c_1=Checkbutton(add_acnt,text='Saving Account:-',variable=at_var,onvalue=1,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
c_1.place(x=580,y=220)
c_2=Checkbutton(add_acnt,text='Current Account:-',variable=at_var,onvalue=2,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
c_2.place(x=580,y=250)
c_3=Checkbutton(add_acnt,text='Fixed1(for 1 year):-',variable=at_var,onvalue=3,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
c_3.place(x=580,y=280)
c_4=Checkbutton(add_acnt,text='Fixed2(for 2 year):-',variable=at_var,onvalue=4,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
c_4.place(x=580,y=310)
c_5=Checkbutton(add_acnt,text='Fixed3(for 3 year):-',variable=at_var,onvalue=5,bg ='#c7ffff',fg='#06088f',
font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
c_5.place(x=580,y=340)
c_6=Checkbutton(add_acnt,text='Please confirm ! if you fill all information correctly',variable=c_var,onvalue=1,
bg ='#c7ffff',fg='#06088f',font = ('Times New Roman', 14),activebackground='#c7ffff',activeforeground='red')
c_6.place(x=60,y=390)
b_1=Button(add_acnt,text='Create account',bg ='red',fg='white',font = ('Times New Roman', 14),
command=create_acnt,width=15,activebackground='red',activeforeground='yellow')
b_1.place(x=65,y=435)
b_2=Button(add_acnt,text='Back',width='13',bg ='red',fg='white',font = ('Times New Roman', 14),
command=(lambda: add_acnt.place_forget() or menu(a_var.get())),activebackground='red',activeforeground='yellow')
b_2.place(x=680,y=435)
if animation:
a_var.set(1)
switch_color()
animation=0
# ============================== -:-:-Menu Window -:-:-==============================
def menu(animation):
#=========================== this will change automatic background color=============================
def set_default_color():
menu_f.config(bg='#c7ffff');m_1.config(bg ='#c7ffff',fg='#06088f');m_2.config(bg ='#c7ffff',fg='#06088f')
back.config(bg ='red',fg='white',activebackground='yellow',activeforeground='red')
b_1.config(bg ='red',fg='white',activebackground='yellow',activeforeground='red')
b_2.config(bg ='red',fg='white',activebackground='yellow',activeforeground='red')
b_3.config(bg ='red',fg='white',activebackground='yellow',activeforeground='red')
b_4.config(bg ='red',fg='white',activebackground='yellow',activeforeground='red')
b_5.config(bg ='red',fg='white',activebackground='yellow',activeforeground='red')
b_6.config(bg ='red',fg='white',activebackground='yellow',activeforeground='red')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
m_2.place(x=340,y=85)
def switch_color():
if (a_var.get())==1:
global c_p,menu_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p]; fg_c=fg_cl[c_p]
menu_f.config(bg=bg_c);m_1.config(bg=bg_c,fg=fg_c);m_2.config(bg=bg_c,fg=fg_c)
back.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
b_1.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
b_2.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
b_3.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
b_4.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
b_5.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
b_6.config(bg=fg_c,fg=bg_c,activebackground=fg_c,activeforeground='white')
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_p+=1
root.after(500,switch_color)
if menu_vv:
m_2.place_forget()
menu_vv=False
else:
m_2.place(x=340,y=85)
m_2.config(bg=bg_c,fg='white')
menu_vv=True
else:
root.after_cancel(switch_color)
set_default_color()
# ================================= Creating Menu Window====================================
a_var=IntVar()
root.title('menu') #setting title
menu_f= Frame(root,height='500',width='900',bg ='#c7ffff')
menu_f.place(x=0,y=0)
m_1=Label(menu_f,text ='ROYAL BANK OF INDIA',cursor='Heart',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 28))
m_1.place(x=250,y=30)
m_2=Label(menu_f,text ='''World's Biggest Bank''',cursor='Heart',bg ='#c7ffff',fg='#06088f',font = ('Times New Roman Bold', 18))
m_2.place(x=340,y=85)
a_c=Checkbutton(menu_f,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',font=("Arial Bold", 10)
,activebackground='#c7ffff',activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
b_1=Button(menu_f,text='NEW ACCOUNT',bd=8,bg ='red',fg='white',width=25,
font = ('Times New Roman Bold', 16),activebackground='red',
activeforeground='yellow',command=(lambda: menu_f.place_forget() or add_new_account(a_var.get())))
b_1.place(x=50,y=160)
b_2=Button(menu_f,text='WITHDRAW/CREDIT',bd=8,bg ='red',fg='white',width=25,
font = ('Times New Roman Bold', 16),activebackground='red',
activeforeground='yellow',command=(lambda: menu_f.place_forget() or withdraw(a_var.get())))
b_2.place(x=500,y=160)
b_3=Button(menu_f,text='BALANCE ENQUIRY',bd=8,bg ='red',fg='white',width=25,
font = ('Times New Roman Bold', 16),activebackground='red',
activeforeground='yellow',command=(lambda: menu_f.place_forget() or check_bal(a_var.get())))
b_3.place(x=50,y=250)
b_4=Button(menu_f,text='SHOW DETAILS',bd=8,bg ='red',fg='white',width=25,
font = ('Times New Roman Bold', 16),activebackground='red',
activeforeground='yellow',command=(lambda: menu_f.place_forget() or show_detail(a_var.get())))
b_4.place(x=500,y=250)
b_5=Button(menu_f,text='CLOSE AN ACCOUNT',bd=8,bg ='red',fg='white',width=25,
font = ('Times New Roman Bold', 16),activebackground='red',
activeforeground='yellow',command=(lambda: menu_f.place_forget() or close_ac(a_var.get())))
b_5.place(x=50,y=350)
b_6=Button(menu_f,text='MODIFY AN ACCOUNT',bd=8,bg ='red',fg='white',width=25,
font = ('Times New Roman Bold', 16),activebackground='red',
activeforeground='yellow',command=(lambda: menu_f.place_forget() or mod_window(a_var.get())))
b_6.place(x=500,y=350)
back=Button(menu_f,text='Back',bd=5,bg ='red',fg='white',width=10,
font = ('Times New Roman Bold', 10),activebackground='red',
activeforeground='yellow',command=(lambda: menu_f.place_forget() or main_root(a_var.get())))
back.place(x=735,y=430)
if animation:
a_var.set(1)
animation=0
switch_color()
#====================== -:-:- Main Home Window -:-:-======================
def main_root(animation):
#======================this will change color automatically================
def set_default_color():
main_f.config(bg='#c7ffff')
l4.place(x=380,y=250);l4.config(bg='#c7ffff',fg='#06088f')
l1.config(bg='#c7ffff',fg='#06088f');l2.config(bg='#c7ffff',fg='#06088f')
l3.config(bg='#c7ffff',fg='#06088f');txt.config(bg='#c7ffff',fg='#06088f')
arw.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
a_c.config(bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',activeforeground='red')
def switch_color():
if (a_var.get())==1:
global c_p,main_vv
if c_p==len(bg_cl):
c_p=0
bg_c=bg_cl[c_p]; fg_c=fg_cl[c_p]
main_f.config(bg=bg_c);l1.config(bg=bg_c,fg=fg_c);l2.config(bg=bg_c,fg=fg_c)
l3.config(bg=bg_c,fg=fg_c);txt.config(bg=bg_c,fg=fg_c)
arw.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
a_c.config(bg=bg_c,fg=fg_c,activebackground=bg_c,activeforeground='white')
c_p+=1
root.after(500,switch_color)
if main_vv:
l4.place_forget()
main_vv=False
else:
l4.place(x=380,y=250)
l4.config(bg=bg_c,fg='white')
main_vv=True
else:
root.after_cancel(switch_color)
set_default_color()
a_var=IntVar()
root.title('home') # setting title
root.configure(bg='#c7ffff') # setting background color
main_f=Frame(root,height='500',width='900',bg='#c7ffff')
main_f.place(x=0,y=0)
a_c=Checkbutton(main_f,text='Animation',variable=a_var, onvalue=1,bg='#c7ffff',fg='#06088f',font=("Arial Bold", 10)
,activebackground='#c7ffff',activeforeground='red',command=switch_color)
a_c.place(x=785,y=10)
l1=Label(main_f,text = 'Welcome To The',bg='#c7ffff',
fg='#06088f',font=("Times New Roman Bold", 28))
l1.place(x=300,y=40)
l2=Label(main_f,text = 'Royal Bank Of India',bg='#c7ffff',
fg='#06088f',font=("Times New Roman Bold", 28))
l2.place(x=270,y=100)
l3=Label(main_f,text = 'Brought By Data Loves',bg='#c7ffff'
,fg='#06088f',font=("Times New Roman Bold", 14))
l3.place(x=630,y=420)
l4=Label(main_f,text = 'Press Arrow',bg='#c7ffff'
,fg='#06088f',font=("Times New Roman Bold", 18))
l4.place(x=380,y=250)
txt=Label(main_f,text = '''World's Biggest Bank''',bg='#c7ffff',
fg='#06088f',font=("Times New Roman", 24))
txt.place(x=300,y=170)
arw=Button(main_f,text='➡',font=("Times New Roman Bold", 64),
bd=0,bg='#c7ffff',fg='#06088f',activebackground='#c7ffff',
activeforeground='red',command=(lambda: main_f.place_forget() or menu(a_var.get())))
arw.place(x=370,y=275)
if animation:
a_var.set(1)
animation=0
switch_color()
# ============== -:-:-:- App Will Start From Here -:-:-:- ==================
root = Tk() #main root
root.iconbitmap('bank_logo.ico') # setting icon
root.resizable(0,0) # this make window unresizable
root.geometry('900x500') # setting height and width of window
# =================== -:-:-:- connecting with database and creating table -:-:-:- ====================
db=sqlite3.connect('Bank_data_base.db') # this coonnect with databse with bmsdb.db file name
db.execute('''create table if not exists bank_management_system(
Account_no integer primary key autoincrement,
name text char(30),
gender text char(15),
date_of_birth text not null,
account_type text char(30),
mobile_no text char(15),
address text char(50),
money real)''')
# ====================This will start home window=================
main_root(0) # this will open main home window function
#============================ -:-:- Starting loop -:-:- =================
root.mainloop()
#========================== Closing Database connection================
db.close()
#============================ This Application has been developed by Mohd Saddam ==============================