-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
3367 lines (2529 loc) · 145 KB
/
main.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
#Changes to be made in line numbers: 26 , 2952 , 3313
#importing Modules
from tkinter import *
import time
import subprocess
#installing shutil and distutil
#uncomment if distutil and shutil are not installed
'''try:
try:
subprocess.run(["pip", "install", "shutil"])
print("shutil installed successfully.")
except:
print("shutil not installed.")
finally:
subprocess.run(["pip", "install", "distutil"])
print("distutil installed successfully.")
except Exception as e:
print(f"Error: {e}")'''
#creating main window
win = Tk()
win.title("Py_Os")
win.config(bg="black")
win.geometry("400x600")
win.resizable(False,False)
favicon_path = "path_to_favicon.ico" #Replace the path
win.iconbitmap(favicon_path)
#setting none values initially to global variables
BMI_Frame=None
BMR_Frame=None
TDEE_Frame=None
MHR_Frame=None
BMI_title_Label=None
BMR_title_Label=None
TDEE_Title_Label=None
MHR_Title_Label=None
BMI_Frame=None
BMR_Frame=None
TDEE_Frame=None
MHR_Frame=None
BMI_title_Label=None
BMR_title_Label=None
TDEE_Title_Label=None
MHR_Title_Label=None
#creating data collection structures
my_dict={}
s1_history=[]
s2_history=[]
i=0
j=0
sent_photos1=[]
recieved_photos1=[]
sent_photos2=[]
recieved_photos2=[]
sent_videos1=[]
recieved_videos1=[]
sent_videos2=[]
recieved_videos2=[]
s1_transact_history=[]
s2_transact_history=[]
media_storage_1=[]
media_storage_2=[]
#creating 2nd window for chat app
global win2
win2 = Tk()
win2.geometry("400x600")
win2.title("Chat win2dow")
win2.config(bg="black")
'''Apps'''
# fitness app
def fitness_app():
def fitness_interface():
global MHR_val,TDEE_val,BMR_val,BMI_val
MHR_val=None
TDEE_val=None
BMR_val=None
BMI_val=None
tdee=None
Interface=Frame(win,width=400,height=600)
Interface.place(x=0,y=0)
MainOptions=Frame(Interface,bg="Red",width=400,height=600)
def Fitness_Calculator_Interface():
Fitness_Calculator_Frame=Frame(Interface,width=400,height=600,bg="black")
Fitness_Calculator_Frame.place(x=0,y=0)
def BMI_Interface():
global BMI_title_Label,BMI_Frame
try:
del_BMI()
except:
print("error")
finally:
BMI_title_Label = Label(Interface, text="BMI Calculator", font="Purisa 20 bold", bg="red", fg="yellow")
BMI_title_Label.pack(side="top", fill=X)
BMI_Frame = Frame(Interface, bg="Black", height=600, width=400)
def del_BMI():
BMI_title_Label.destroy()
BMI_Frame.destroy()
Exit_Interface=Button(BMI_title_Label,text="Back",relief="solid",bg="red",fg="White",bd=1,command=del_BMI)
Exit_Interface.pack(side="right",padx=10)
BMI_Weight_Frame = Frame(BMI_Frame, bg="Yellow", height=105, width=150)
BMI_Weight_Frame.place(x=30, y=100)
BMI_Weight_Label = Label(BMI_Frame, bg="black", fg="White", text="Weight in kg", font=("Purisa 15 bold"), width=11)
BMI_Weight_Label.place(x=35, y=105)
BMI_Weight_Entry = Entry(BMI_Frame, font=("Purisa 15 bold"), width=11, bd=2, cursor="xterm", justify='center')
BMI_Weight_Entry.place(x=40, y=155)
BMI_Height_Frame = Frame(BMI_Frame, bg="yellow", height=105, width=150)
BMI_Height_Frame.place(x=220, y=100)
BMI_Height_Label = Label(BMI_Frame, bg="black", fg="White", text="Height in cm", font=("Purisa 15 bold"), width=11)
BMI_Height_Label.place(x=225, y=105)
BMI_Height_Entry = Entry(BMI_Frame, font=("Purisa 15 bold"), width=11, bd=2, cursor="xterm", justify='center')
BMI_Height_Entry.place(x=230, y=155)
def calculate_bmi():
try:
weight_val = float(BMI_Weight_Entry.get())
height_val = float(BMI_Height_Entry.get()) / 100
BMI_Warning = Label(BMI_Frame, text="", font=("Purisa 15 bold"), bg="black", fg="red")
BMI_Warning.place_forget()
global BMI_val
BMI_val = weight_val / (height_val ** 2)
BMI_Result = Label(BMI_Frame, text=f"BMI: {BMI_val:.2f}", font=("Purisa 15 bold"), bg="black", fg="green")
BMI_Result.place(x=150, y=300)
except ValueError:
BMI_Warning = Label(BMI_Frame, text="Please enter NUMERIC VALUES only", font=("Purisa 10 bold"), bg="black", fg="red")
BMI_Warning.place(x=90, y=300)
win.after(2000,lambda:BMI_Warning.destroy())
BMI_Calculate_Button = Button(BMI_Frame, font=("Purisa 15 bold"), text="Calculate", bd=2, cursor="hand2", bg="blue", fg="white", command=calculate_bmi)
BMI_Calculate_Button.place(x=150, y=230)
BMI_Frame.pack(fill=Y)
def BMR_interface():
global BMR_title_Label,BMR_Frame
try:
del_BMR()
except:
print("error")
finally:
global Gender_male, Gender_female, BMR_title_Label, BMR_Frame, BMR_Weight_Entry, BMR_Height_Entry, BMR_Age_Entry, value1, value2, value3, value4, BMR_Warning,BMR_val
value1 = 0
value2 = 0
value3 = 0
value4 = 0
def male_Button_pressed():
global value1, value2, value3, value4
Gender_female.config(bg="gray", fg="black")
Gender_male.config(bg="Blue", fg="White")
value1 = 88.362
value2 = 13.397
value3 = 4.799
value4 = 5.677
def female_Button_pressed():
global value1, value2, value3, value4
Gender_male.config(bg="gray", fg="black")
Gender_female.config(bg="Light Pink", fg="White")
value1 = 447.593
value2 = 9.247
value3 = 3.098
value4 = 4.330
BMR_title_Label = Label(Interface, text="BMR Calculator", font="Purisa 20 bold", bg="red", fg="yellow")
BMR_title_Label.pack(side="top", fill=X)
BMR_Frame = Frame(Interface, bg="Black", height=600, width=400)
def del_BMR():
BMR_title_Label.destroy()
BMR_Frame.destroy()
Exit_Interface=Button(BMR_title_Label,text="Back",relief="solid",bg="red",fg="White",bd=1,command=del_BMR)
Exit_Interface.pack(side="right",padx=10)
Gender_male = Button(BMR_Frame, bg="gray", fg="black", text="♂ Male", font=("Purisa 15 bold"), width=10,command=male_Button_pressed)
Gender_male.place(x=50, y=50)
Gender_female = Button(BMR_Frame, bg="gray", fg="black", text="♀ Female", font=("Purisa 15 bold"), width=10, command=female_Button_pressed)
Gender_female.place(x=200, y=50)
BMR_Weight_Label = Label(BMR_Frame, text="Weight in kg:", font=("Purisa 15 bold"), fg="white", bg="black")
BMR_Weight_Label.place(x=60, y=120)
BMR_Weight_Entry = Entry(BMR_Frame, font=("Purisa 15 bold"), width=11, justify="center")
BMR_Weight_Entry.place(x=200, y=120)
BMR_Height_Label = Label(BMR_Frame, text="Height in cm:", font=("Purisa 15 bold"), fg="white", bg="black")
BMR_Height_Label.place(x=60, y=160)
BMR_Height_Entry = Entry(BMR_Frame, font=("Purisa 15 bold"), width=11, justify="center")
BMR_Height_Entry.place(x=200, y=160)
BMR_Age_Label = Label(BMR_Frame, text="Age:", font=("Purisa 15 bold"), fg="white", bg="black")
BMR_Age_Label.place(x=100, y=200)
BMR_Age_Entry = Entry(BMR_Frame, font=("Purisa 15 bold"), width=11, justify="center")
BMR_Age_Entry.place(x=200, y=200)
def calculate_bmr():
global BMR_Weight_Entry, BMR_Height_Entry, BMR_Age_Entry, BMR_Frame, value1, value2, value3, value4,BMR_Warning,BMR_val
weight_val =(BMR_Weight_Entry.get())
height_val =(BMR_Height_Entry.get())
age_val =(BMR_Age_Entry.get())
if weight_val.isnumeric()==False or height_val.isnumeric()==False or age_val.isnumeric()==False:
BMR_Warning = Label(BMR_Frame, text="Please enter NUMERIC VALUES only", font=("Purisa 10 bold"), bg="black", fg="red")
BMR_Warning.place(x=90, y=300)
win.after(2000,lambda:BMR_Warning.destroy())
else:
weight_val=float(weight_val)
height_val=float(height_val)
age_val=float(age_val)
if value1 == 0 or value2 == 0 or value3 == 0 or value4==0:
BMR_Warning = Label(BMR_Frame, text="Please Select Any One Gender", font=("Purisa 10 bold"), bg="black", fg="red")
BMR_Warning.place(x=100, y=300)
win.after(2000,lambda:BMR_Warning.destroy())
else:
try:
print(f"Weight: {weight_val}, Height: {height_val}, Age: {age_val}")
print(f"Constants: {value1}, {value2}, {value3}, {value4}")
BMR_val = value1 + (value2 * weight_val) + (value3 * height_val) - (value4 * age_val)
if BMR_val <= 1500:
BMR_Result = Label(BMR_Frame, text=f"BMR: {BMR_val:.2f}", font=("Purisa 15 bold"), bg="light goldenrod", fg="black")
BMR_Result.place(x=135, y=320)
elif 1500 < BMR_val < 1800:
BMR_Result = Label(BMR_Frame, text=f"BMR: {BMR_val:.2f}", font=("Purisa 15 bold"), bg="light green", fg="Black")
BMR_Result.place(x=135, y=320)
else:
BMR_Result = Label(BMR_Frame, text=f"BMR: {BMR_val:.2f}", font=("Purisa 15 bold"), bg="red", fg="white")
BMR_Result.place(x=135, y=320)
def TDEE_interface():
from tkinter import ttk
try:
del_TDEE()
except:
print(f"Error")
finally:
try:
del_BMR()
except:
print("None")
global TDEE_Frame, TDEE_Title_Label, TDEE_slider, activity_label,BMR_val
TDEE_Title_Label = Label(Interface, text=" Total Daily Energy Expenditure", font="Purisa 15 bold", bg="Black", fg="White",anchor="w")
TDEE_Title_Label.pack(side="top", fill=X)
TDEE_Frame = Frame(Interface, bg="white", height=600, width=400)
TDEE_Frame.pack(fill=Y)
def del_TDEE():
TDEE_Title_Label.destroy()
TDEE_Frame.destroy()
Exit_Interface_TDEE=Button(TDEE_Title_Label,text="Back",relief="solid",bg="red",fg="White",bd=1,command=del_TDEE)
Exit_Interface_TDEE.pack(side="right",padx=10)
activity_label = Label(TDEE_Frame, text="", font=("Arial", 12))
activity_label.place(x=50, y=170)
activity_levels = {
1: " Sedentary \n (Little to no exercise)",
2: " Lightly active \n (Exercise/sports 1-3 days/week)",
3: " Moderately active \n (Exercise/sports 3-5 days/week)",
4: " Very active \n (Exercise/sports 6-7 days a week)",
5: " Extremely active \n (Exercise/sports & physical job or training)"
}
def get_value(value):
print(value)
TDEE_slider = Scale(TDEE_Frame, from_=1, to=5, orient=VERTICAL, length=300, bg="black", fg="white", command=lambda v: get_value(v))
TDEE_slider.set(1)
TDEE_slider.place(x=50, y=50)
TDEE_slider_Activity_Label_1=Label(TDEE_Frame,text=activity_levels[1],bg="White",fg="Black",font=("Purisa 10 bold"), anchor="center")
TDEE_slider_Activity_Label_1.place(x=150,y=55)
TDEE_slider_Activity_Label_2=Label(TDEE_Frame,text=activity_levels[2],bg="White",fg="Black",font=("Purisa 10 bold"), anchor="center")
TDEE_slider_Activity_Label_2.place(x=125,y=120)
TDEE_slider_Activity_Label_3=Label(TDEE_Frame,text=activity_levels[3],bg="White",fg="Black",font=("Purisa 10 bold"), anchor="center")
TDEE_slider_Activity_Label_3.place(x=125,y=185)
TDEE_slider_Activity_Label_4=Label(TDEE_Frame,text=activity_levels[4],bg="White",fg="Black",font=("Purisa 10 bold"), anchor="center")
TDEE_slider_Activity_Label_4.place(x=120,y=250)
TDEE_slider_Activity_Label_5=Label(TDEE_Frame,text=activity_levels[5],bg="White",fg="Black",font=("Purisa 10 bold"), anchor="center")
TDEE_slider_Activity_Label_5.place(x=90,y=316)
ttk.Separator(TDEE_Frame, orient='horizontal').place(x=0, y=370, relwidth=1)
BMR_Indicator=Label(TDEE_Frame,text=f"BMR: {BMR_val}",font=("Purisa 12 bold"),anchor="center",bg="White",fg="Green")
BMR_Indicator.place(x=120,y=380)
def cal_TDEE():
global TDEE_slider, BMR_val, activity_label
try:
global tdee
tdee=TDEE_slider.get()
activity_level = int(TDEE_slider.get())
activity_multiplier = {
1: 1.2, # Sedentary (Little to no exercise)
2: 1.375, # Lightly active (Exercise/sports 1-3 days/week)
3: 1.55, # Moderately active (Exercise/sports 3-5 days/week)
4: 1.725, # Very active (Exercise/sports 6-7 days a week)
5: 1.9 # Extremely active (Exercise/sports & physical job or training)
}
if not BMR_val:
try:
TDEE_Result_Label.destroy()
except:
print("No TDEE Result")
finally:
TDEE_Result=Label(TDEE_Frame,fg="red",bg="White",font=("Purisa 10 bold"),text=("BMR value is not calculated."))
TDEE_Result.place(x=65,y=480)
global TDEE_val
TDEE_val = BMR_val * activity_multiplier[activity_level]
TDEE_Result = Label(TDEE_Frame, text=f"TDEE: {TDEE_val:.2f} calories/day", font=("Purisa 15 bold"), bg="white", fg="black")
TDEE_Result.place(x=70, y=480)
except ValueError as e:
try:
TDEE_Warning.destroy()
except:
print("No Warning")
finally:
TDEE_Warning = Label(TDEE_Frame, text=f"Error: {e}", font=("Purisa 10 bold"), bg="black", fg="red")
TDEE_Warning.place(x=50, y=490)
win.after(2000, lambda: TDEE_Warning.destroy())
Cal_TDEE_Button=Button(TDEE_Frame,text="Calculate",font=("Purisa 15 bold"),justify="center",bg="Blue",fg="white",command=cal_TDEE)
Cal_TDEE_Button.place(x=160,y=425)
BMI_Reset_Button = Button(BMR_Frame, text="Reset", font=("Purisa 15 bold"), bg="red", fg="white", command=lambda:({del_BMR(),BMR_interface()}), relief=FLAT)
BMI_Reset_Button.place(x=165, y=370)
TDEE_button_direct=Button(BMR_Frame,text="Check Your Total Daily Energy Expenditure (TDEE)",font=("Purisa 10 bold"),bg="black",fg="red",relief=FLAT,command=TDEE_interface)
TDEE_button_direct.place(x=35,y=430)
except ValueError:
BMR_Warning = Label(BMR_Frame, text="Please enter NUMERIC VALUES only", font=("Purisa 10 bold"), bg="black", fg="red")
BMR_Warning.place(x=90, y=300)
win.after(2000,lambda:BMR_Warning.destroy())
BMR_Calculate_button = Button(BMR_Frame, text="Calculate", font=("Purisa 15 bold"), bd=2, cursor="hand2", bg="blue",fg="white", command=calculate_bmr)
BMR_Calculate_button.place(x=150, y=250)
BMR_Frame.pack(fill=Y)
def cal_MHR():
try:
del_MHR()
except:
print("Error")
finally:
global MHR_title_Label, MHR_Frame, MHR_Age_Entry, MHR_Result_Label, MHR_Warning
MHR_title_Label = Label(Interface, text="Maximum Heart Rate Calculator", font="Purisa 15 bold", bg="red", fg="yellow")
MHR_title_Label.pack(side="top", fill=X)
MHR_Frame = Frame(Interface, bg="Black", height=600, width=400)
def del_MHR():
MHR_title_Label.destroy()
MHR_Frame.destroy()
Exit_Interface_MHR=Button(MHR_title_Label,text="Back",relief="solid",bg="red",fg="White",bd=1,command=del_MHR)
Exit_Interface_MHR.pack(side="right",padx=10)
MHR_Age_Label = Label(MHR_Frame, text="Age:", font=("Purisa 15 bold"), fg="white", bg="black")
MHR_Age_Label.place(x=100, y=200)
MHR_Age_Entry = Entry(MHR_Frame, font=("Purisa 15 bold"), width=11, justify="center")
MHR_Age_Entry.place(x=150, y=200)
def calculate_mhr():
global MHR_Age_Entry, MHR_Frame, MHR_Warning
age_val = MHR_Age_Entry.get()
if age_val.isnumeric() == False:
MHR_Warning = Label(MHR_Frame, text="Please enter a valid age", font=("Purisa 10 bold"), bg="black", fg="red")
MHR_Warning.place(x=90, y=300)
win.after(2000, lambda: MHR_Warning.destroy())
else:
global MHR_val
age_val = float(age_val)
MHR_val = 220 - age_val
MHR_Result_Label = Label(MHR_Frame, text=f"Maximum Heart Rate: {MHR_val} bpm", font=("Purisa 15 bold"), bg="white", fg="black")
MHR_Result_Label.place(x=50, y=340)
MHR_Calculate_Button = Button(MHR_Frame, text="Calculate", font=("Purisa 12 bold"),width=15, bd=2, cursor="hand2", bg="blue", fg="white", command=calculate_mhr)
MHR_Calculate_Button.place(x=125, y=250)
MHR_Frame.pack(fill=Y)
BMI_Enter=Button(Fitness_Calculator_Frame,font=("Purisa 21 bold"),relief="solid",bd=2,text="BMI",bg="Yellow",fg="Black",command=BMI_Interface)
BMI_Enter.place(x=167,y=100)
BMR_Enter=Button(Fitness_Calculator_Frame,font=("Purisa 20 bold"),relief="solid",bd=2,text="BMR",bg="Blue",fg="White",command=BMR_interface)
BMR_Enter.place(x=162,y=200)
MHR_Enter=Button(Fitness_Calculator_Frame,font=("Purisa 20 bold"),relief="solid",bd=2,text="MHR",bg="Green",fg="White",command=cal_MHR)
MHR_Enter.place(x=162,y=300)
Back_Fitness_Cal=Button(Fitness_Calculator_Frame,font=("Purisa 20 bold"),relief="solid",bd=2,text="Back",bg="Red",fg="White",command=Fitness_Calculator_Frame.destroy)
Back_Fitness_Cal.place(x=162,y=400)
def Check_Record():
global MHR_val,TDEE_val,BMR_val,BMI_val
Check_Record_Label = Label(Interface, text="Test Your Fitness", font="Purisa 16 bold",width=40,anchor="w", bg="Light Pink", fg="Black")
Check_Record_Label.place(x=0, y=0)
Check_Record_Frame = Frame(Interface, bg="Black", height=600, width=400)
def del_Check_Record():
Check_Record_Label.destroy()
Check_Record_Frame.destroy()
Bmi_text=None
Bmr_text=None
Tdee_text=None
Mhr_text=None
if BMI_val!=None:
Bmi_text=f"{BMI_val:.2f}"
if BMR_val!=None:
Bmr_text=f"{BMR_val:.2f}"
if TDEE_val!=None:
Tdee_text=f"{TDEE_val:.2f}"
if MHR_val!=None:
Mhr_text=f"{MHR_val:.2f}"
Exit_Interface_Check_Record=Button(Check_Record_Label,text="Back",relief="solid",bg="red",fg="White",bd=1,command=del_Check_Record)
Exit_Interface_Check_Record.place(x=350,y=2)
Table_Cal_Name= Label(Check_Record_Frame, text="Calculator", font="Purisa 12 bold", bg="Black", fg="Light Pink")
Table_Cal_Name.place(x=75,y=50)
Table_Cal_Result= Label(Check_Record_Frame, text="Result", font="Purisa 12 bold", bg="Black", fg="Light Pink")
Table_Cal_Result.place(x=250,y=50)
BMI_label=Label(Check_Record_Frame, text="BMI", font="Purisa 10 bold", bg="Black", fg="white")
BMI_label.place(x=100,y=100)
Bmi_Label=Label(Check_Record_Frame,text=f"{Bmi_text}", font="Purisa 10 bold", bg="Black", fg="white")
Bmi_Label.place(x=260,y=100)
BMR_label=Label(Check_Record_Frame, text="BMR", font="Purisa 10 bold", bg="Black", fg="white")
BMR_label.place(x=100,y=150)
Bmr_Label=Label(Check_Record_Frame,text=f"{Bmr_text}", font="Purisa 10 bold", bg="Black", fg="white")
Bmr_Label.place(x=260,y=150)
TDEE_label=Label(Check_Record_Frame, text="TDEE", font="Purisa 10 bold", bg="Black", fg="white")
TDEE_label.place(x=98,y=200)
TDEE_Label=Label(Check_Record_Frame,text=f"{Tdee_text}", font="Purisa 10 bold", bg="Black", fg="white")
TDEE_Label.place(x=260,y=200)
MHR_label=Label(Check_Record_Frame, text="MHR", font="Purisa 10 bold", bg="Black", fg="white")
MHR_label.place(x=100,y=250)
MHR_Label=Label(Check_Record_Frame,text=f"{Mhr_text}", font="Purisa 10 bold", bg="Black", fg="white")
MHR_Label.place(x=260,y=250)
def cal_score():
def check_all_vals():
global MHR_val,TDEE_val,BMR_val,BMI_val
if BMI_val==0 or BMI_val==None:
try:
check_BMI.destroy()
except:
print(" ")
finally:
check_BMI=Label(Check_Record_Frame,text="X",fg="red",bg="Black",font=("Purisa 12 bold"))
check_BMI.place(x=325,y=100)
else:
try:
check_BMI.destroy()
except:
print(" ")
finally:
check_BMI=Label(Check_Record_Frame,text="✓",fg="green",bg="Black",font=("Purisa 12 bold"))
check_BMI.place(x=325,y=100)
if BMR_val==0 or BMR_val==None:
try:
check_BMR.destroy()
except:
print(" ")
finally:
check_BMR=Label(Check_Record_Frame,text="X",fg="red",bg="Black",font=("Purisa 12 bold"))
check_BMR.place(x=325,y=150)
else:
try:
check_BMR.destroy()
except:
print(" ")
finally:
check_BMR=Label(Check_Record_Frame,text="✓",fg="green",bg="Black",font=("Purisa 12 bold"))
check_BMR.place(x=325,y=150)
if TDEE_val==0 or TDEE_val==None:
try:
check_TDEE.destroy()
except:
print(" ")
finally:
check_TDEE=Label(Check_Record_Frame,text="X",fg="red",bg="Black",font=("Purisa 12 bold"))
check_TDEE.place(x=325,y=200)
else:
try:
check_TDEE.destroy()
except:
print(" ")
finally:
check_TDEE=Label(Check_Record_Frame,text="✓",fg="green",bg="Black",font=("Purisa 12 bold"))
check_TDEE.place(x=325,y=200)
if MHR_val==0 or MHR_val==None:
try:
check_MHR.destroy()
except:
print(" ")
finally:
check_MHR=Label(Check_Record_Frame,text="X",fg="red",bg="Black",font=("Purisa 12 bold"))
check_MHR.place(x=325,y=250)
else:
try:
check_MHR.destroy()
except:
print(" ")
finally:
check_MHR=Label(Check_Record_Frame,text="✓",fg="green",bg="Black",font=("Purisa 12 bold"))
check_MHR.place(x=325,y=250)
def scoring():
global MHR_val,TDEE_val,BMR_val,BMI_val,TDEE_slider
try:
Fitness_Score_Label.destroy()
Comment_Label.destroy()
except:
print("Nothing")
finally:
if BMI_val!=None and BMR_val!=None and TDEE_val!=None and MHR_val!=None:
pass
else:
def Redirect():
try:
Check_Record_Frame.destroy()
except:
print("No Check_Record_Frame")
finally:
Fitness_Calculator_Interface()
warning_cal=Button(Check_Record_Frame,font=("Purisa 10 bold"),text="Error: Some fitness values (MHR, TDEE, BMR, BMI) \n are missing or not calculated properly. \n Click Here and Calculate them",command=lambda: (del_Check_Record(), Redirect()),fg="Red",bg="White")
warning_cal.place(x=37, y=390)
check_all_vals()
win.after(1000,scoring)
check_record_button=Button(Check_Record_Frame,text="Check",font=("Purisa 12 bold"),command=cal_score)
check_record_button.place(x=150,y=325)
Check_Record_Frame.place(x=0,y=30)
def mainoptions_screen():
MainOptions.place(x=0,y=0)
Fitness_Calculators=Button(MainOptions,font=("Purisa 20 bold"),relief="solid",bd=0,text="Calculate Fitness",bg="gold",fg="White",command=Fitness_Calculator_Interface)
Fitness_Calculators.place(x=75,y=600)
Fitness_Test=Button(MainOptions,font=("Purisa 20 bold"),relief="solid",bd=0,text="Check Record",bg="Blue",fg="White",command=Check_Record)
Fitness_Test.place(x=95,y=800)
Fitness_Interface_Exit=Button(MainOptions,font=("Purisa 20 bold"),relief="solid",bd=0,text="Exit",bg="Red",fg="White")
Fitness_Interface_Exit.place(x=162,y=900)
for y in range(300):
Fitness_Interface_Exit.place(x=162, y=y)
Fitness_Interface_Exit.config(command=Interface.destroy)
MainOptions.config(bg="Red")
MainOptions.update()
for y in range(200):
Fitness_Interface_Exit.config(bd=2)
Fitness_Test.place(x=95, y=y)
MainOptions.config(bg="Blue")
MainOptions.update()
for y in range(100):
Fitness_Test.config(bd=2)
Fitness_Calculators.place(x=75, y=y)
Fitness_Calculators.config(command=Fitness_Calculator_Interface)
MainOptions.config(bg="Gold")
MainOptions.update()
win.after(1000,lambda:{MainOptions.config(bg="Orange"),Fitness_Calculators.config(bd=2)})
mainoptions_screen()
fitness_interface()
#Bank APP
global Balance
Balance = 10000
def Bank_APPS():
win.after(1000,del_apps)
win.after(1000, lambda: Bank_Ap())
def Bank_Ap():
del_nav()
win.config(bg="orange")
win.after(2500, bank_start())
global bank_Logo
def bank_start():
global bank_Logo
bank_Logo = Label(win,bg="orange", text="Bank \n A Safe & Best Banking Experience",font=("Bold", 15))
bank_Logo.pack(pady=200)
win.after(6000, lock)
def lock():
bank_Logo.destroy()
win.config(bg="Black")
global Password, Username_Label, Login, Bank_Exit, Show_Pass
Username_Label = Label(win, bg="Black", fg="Gray", text="\n Bank_User@02215", font=("Bold", 15))
Username_Label.place(x=105, y=150)
Password = Entry(win, bd=5, font=('Georgia 15'), show="*")
def Show_pass():
if Password.cget("show") == "*":
Password.config(show="")
Show_Pass.config(text="Hide")
else:
Password.config(show="*")
Show_Pass.config(text="Show")
Show_Pass = Button(Password, font=("Bold", 10), text="Show", command=Show_pass)
Show_Pass.place(x=200, y=0)
Password.place(x=80, y=220)
Login = Button(win, bg="Blue", fg="white", font=("Bold", 15), text="Login", command=Check_Pass)
Login.place(x=210, y=270)
Bank_Exit = Button(win, bg="Black", fg="red", font=("Bold", 15), text="Exit", relief=FLAT, command=bank_exit_login)
Bank_Exit.place(x=140, y=270)
global Pass
Pass="User@Royal_College"
def Check_Pass():
entered_password = Password.get()
global result_label
if entered_password == Pass:
result_label = Label(win, bg="Black", text="Logging You In...", fg="green")
result_label.place(x=150, y=350)
win.after(2000, Del_Login)
win.after(2000, lambda: bank_interface())
else:
result_label = Label(win, bg="Black", text="Incorrect Password. Try again.", fg="red")
result_label.place(x=125, y=350)
win.after(2000,lambda: result_label.destroy())
def Del_Login():
Login.destroy()
Password.destroy()
Username_Label.destroy()
Bank_Exit.destroy()
try:
result_label.destroy()
except:
pass
def bank_exit_login():
win.after(1000, Del_Login())
win.after(1000, main_win())
def bank_interface():
global bal_button, Loan_Button, Settings, Exit_B
Loan_Button = Button(win, bg="Blue", fg="white", font=("Bold", 15), text="Loan", width=15, height=5,command= Loan_Page)
Loan_Button.place(x=40, y=160)
bal_button = Button(win, bg="Red", fg="white", font=("Bold", 15), text="Balance", width=10, height=10, command=Bal_Page)
bal_button.place(x=235, y=160)
Settings = Button(win, bg="Gray", fg="Yellow", font=("Bold", 15), text="Change Password", width=15, command=Settings_Page)
Settings.place(x=40, y=310)
Exit_B = Button(win, bg="Yellow", fg="Black", font=("Bold", 15), text="Exit", width=15,command=Exit_Bank_APP)
Exit_B.place(x=40, y=368)
def Del_Interface():
global bal_button, Loan_Button, Settings, Exit_B
bal_button.destroy()
Loan_Button.destroy()
Settings.destroy()
Exit_B.destroy()
def Exit_Bank_APP():
Del_Interface()
show_nav()
def Bal_Page():
win.after(1000, Del_Interface())
global Bal_Label, Exit_Bal
win.config(bg="Black")
Bal_Label = Label(win, bg="Blue", fg="white", font=("Bold", 15), text=("Balance:",Balance), width=25, height=5)
Bal_Label.place(x=60, y=170)
Exit_Bal=Button(win, text="Exit",font=("Bold", 15),command=Exit_Bal_Page)
Exit_Bal.place(x=180, y=320)
def Exit_Bal_Page():
global Bal_Label, Exit_Bal
Bal_Label.destroy()
Exit_Bal.destroy()
win.after(1000, lambda: bank_interface())
global loan_count
loan_count = 0
def show_warning(loan_frame, loan_label, loan_button):
loan_frame.destroy()
loan_label.destroy()
warning_frame = Frame(win, bg="gray")
warning_label = Label(warning_frame, bg="gray", fg="white", font=("Bold", 15),
text="You have reached the loan limit of \n Rs 100,000")
warning_label.pack(pady=40)
warning_accept=Button(warning_frame, bg="black", fg="white", font=("Bold", 15),
text="OK", command=lambda: cleanup_warning(warning_frame, warning_label, loan_button))
warning_accept.pack(pady=10)
warning_frame.pack(pady=70)
def cleanup_warning(warning_frame, warning_label, loan_button):
warning_frame.destroy()
warning_label.destroy()
win.after(1000, bank_interface())
def loan_grant(loan_ammt):
global Balance, Loan_Button
if Balance >= 100000:
win.after(1000, lambda: show_warning(Loan_Frame, Loan_Label, Loan_Button))
else:
if loan_ammt == Loan_10K:
Balance += 10000
elif loan_ammt == Loan_50K:
Balance += 50000
else:
Balance += 90000
def Loan_Page():
win.after(1000, Del_Interface())
global Loan_Frame,Loan_10K,Loan_50K,Loan_100K,Loan_Label
Loan_Label = Label(win, bg="Black", fg="white", font=("Bold", 20), text=("LOAN"), width=25, height=5)
Loan_Label.pack(pady=40)
Loan_Frame = Frame(win, bg="gray")
Loan_10K = Button(Loan_Frame, bg="Black", fg="White", text="Rs.10,000", font=("Bold", 15), relief=FLAT,command= lambda: loan_grant(Loan_10K))
Loan_10K.pack(padx=20, pady=15)
Loan_50K = Button(Loan_Frame, bg="Black", fg="White", text="Rs.50,000", font=("Bold", 15), relief=FLAT, command= lambda: loan_grant(Loan_50K))
Loan_50K.pack(padx=20, pady=15)
Loan_90K = Button(Loan_Frame,bg="Black", fg="White", text="Rs.90,000", font=("Bold", 15), relief=FLAT, command= lambda: loan_grant(Loan_90K))
Loan_90K.pack(padx=20, pady=15)
Exit_Loan = Button(Loan_Frame,bg="Red", fg="Black", text="Back", font=("Bold", 15), relief=FLAT, command= lambda: Exit_Loan_Page())
Exit_Loan.pack(padx=20, pady=15)
Loan_Frame.place(x=125, y=150)
def Exit_Loan_Page():
global Loan_Frame, Loan_Label, Loan_Button
Loan_Frame.destroy()
Loan_Label.destroy()
win.after(1000, bank_interface)
def Settings_Page():
global Setting_Frame,Current_Password,New_Password
Setting_Frame=Frame(win,bg="Gray", height=600, width=400)
Settings_Label=Label(Setting_Frame, bg="Gray",fg="Black",text="Settings", font=("Arial 20 bold"))
Settings_Label.place(x=42, y=33)
Back_Settings=Button(Setting_Frame, bg="Gray",fg="Black",text="<", font=("Arial 15 bold"),relief=FLAT,cursor="sb_left_arrow",command= del_Settings_Page)
Back_Settings.place(x=10, y=30)
text_current=StringVar()
text_new=StringVar()
Current_Password= Entry(Setting_Frame, textvariable=text_current, font=("Arial 14"), width=25)
Current_Password.place(x=50, y=200)
Current_Password.focus()
Current_Password.insert(0, "Enter Current Password")
New_Password= Entry(Setting_Frame, textvariable=text_new, font=("Arial 14 "), width=25)
New_Password.place(x=50, y=250)
New_Password.focus()
New_Password.insert(0, "Enter New Password")
CP_Button=Button(Setting_Frame, bg="white", fg="Black",text="Change Password",font=("Arial 15 bold"),command=change_Password)
CP_Button.place(x=100,y=300)
Setting_Frame.pack(fill="both", expand="yes")
def del_Settings_Page():
global Setting_Frame
Setting_Frame.destroy()
def change_Password():
global Current_Pass,New_Password,Pass,Setting_Frame
c_p=Current_Password.get()
n_p=New_Password.get()
if (c_p==Pass):
Pass=n_p
Change=Label(Setting_Frame, bg="Gray",fg="Green",text="Password Updated", font=("Arial 15 bold"))
Change.place(x=90, y=350)
win.after(2000,lambda:Change.destroy())
win.after(1000,del_Settings_Page)
else:
Change=Label(Setting_Frame, bg="Gray",fg="Red",text="Incorrect Current Password", font=("Arial 15 bold"))
Change.place(x=70, y=350)
win.after(2000,lambda:Change.destroy())
#shop app
log = 0
log_gui = 0
def Exit_Shopping_App():
global menubar,LogIn,log_gui
try:
menubar.destroy()
LogIn.destroy()
log_gui=0
except Exception as e:
print(f"An error occurred during menubar destruction: {e}")
show_nav()
def Shopping_Interface():
global menubar,log,Ad_Frame_1,log,log_gui
menubar = Menu(win)
options = Menu(menubar, tearoff=0)
options.add_command(label="Shop", command=shop_Check_log)
options.add_command(label="My Orders", command=orders_Check_log)
theme_submenu = Menu(options, tearoff=0)
theme_submenu.add_command(label="Dark", command=lambda: Change_Theme("#1e1e1e"))
theme_submenu.add_command(label="Light", command=lambda: Change_Theme("white"))
theme_submenu.add_command(label="Gray", command=lambda: Change_Theme("#808080"))
options.add_cascade(label="Theme Change", menu=theme_submenu)
options.add_separator()
options.add_command(label="Back", command=win.quit)
menubar.add_cascade(label=" ≡ ", font=("arial 15 bold"), menu=options)
Account = Menu(menubar, tearoff=0)
Account.add_command(label="Log Out", command=Log_Out)
Account.add_separator()
menubar.add_cascade(label="Account", font=("arial 15 bold"), menu=Account)
Exit = Menu(menubar, tearoff=0)
Exit.add_command(label="Are You Sure: Yes", command=Exit_Shopping_App)
Exit.add_command(label="Are You Sure: No", command=win.quit)
menubar.add_cascade(label="Exit", menu=Exit)
win.config(menu=menubar)
if log == 0:
if log_gui==0:
log_gui = 1
Ad_Frame_1 = Frame(win, bg="Red")
Ad_1 = Label(Ad_Frame_1, bg="Red", fg="white",
text="You Need To Login Everytime You Open This App!! \n To Log In press button", font=("Arial 10 bold"))
Ad_1.pack(pady=10)
Ad_1_button = Button(Ad_Frame_1, bg="Green", fg="white", text=" Log In", font=("Arial 13 bold"),
command=lambda: more_ads())
Ad_1_button.pack(pady=5)
Ad_Frame_1.pack(pady=20)
else:
pass
elif log == 1:
more_ads()
def more_ads():
global log, Ad_Frame_1, log_gui
log = 1
log_gui = 0
Ad_Frame_1.destroy()
def Log_Out():
global LogIn, log, log_gui, Ad_Frame_1
log = 0
if log_gui == 0:
log_gui = 1
if 'Ad_Frame_1' in locals():
Ad_Frame_1.destroy()
LogIn = Frame(win, bg="Red")
LogIn_Message = Label(LogIn, bg="Red", fg="White", font=("arial 10 bold"),
text="In Order To Continue Shopping You Need To LOG IN \n Log Into User@02215 (Passwordless)")
LogIn_Message.pack(pady=30)
def log_in_action():
LogIn.destroy()
global log, log_gui
log = 1
log_gui = 1
LogIn_Button = Button(LogIn, bg="yellow", text="LOG IN", command=log_in_action)