-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarebear.py
More file actions
1147 lines (888 loc) · 53.5 KB
/
Copy pathCarebear.py
File metadata and controls
1147 lines (888 loc) · 53.5 KB
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 customtkinter as c
from tkinter import *
from PIL import Image,ImageTk
gr="#689581"
br="#c5ae94"
img=c.CTkImage(Image.open("bear.png"),size=(200,200))
c.set_appearance_mode('dark')
c.set_default_color_theme("green") # Themes: "blue" (standard), "green", "dark-blue"
root= c.CTk()
root.title('Login')
root.geometry('400x700')
root.configure(bg='#fff')
root.resizable(False,False)
#first page
def enter():
pass
lb.destroy()
la.destroy()
lc.destroy()
button.destroy()
li.destroy()
li=c.CTkLabel(root,text="",image=img)
li.pack(pady=10)
lb=c.CTkLabel(root,text="Welcome!!!",font=('Comic Sans MS',28,'bold'))
lb.pack(pady=30)
la=c.CTkLabel(root, text="CAREBEAR:",font=("Fixedsys",30))
la.pack(pady=10)
lc=c.CTkLabel(root, text="A Guide To Healthier You", font=("Fixedsys",30))
lc.pack(pady=10)
button = c.CTkButton(root, text="Click to enter",
height=100,
width=300,
text_color='black',
font=('Comic Sans MS',20,'bold'),
border_color='white',
fg_color='#689581',
hover_color='#c5ae94',command=enter)
button.pack(pady=90)
#second page
def enter2():
r.destroy()
name1.destroy()
name2.destroy()
b2.destroy()
r=c.CTkLabel(root,text="LOGIN",font=('Comic Sans MS',40,"bold"),text_color='#c5ae94')
r.pack(pady=50)
name1=c.CTkEntry(root,placeholder_text="Name",
width=200,
height=40,
placeholder_text_color="#689581",
text_color="#c5ae94")
name1.pack(pady=10)
name2=c.CTkEntry(root,placeholder_text="Surname",
width=200,
height=40,
placeholder_text_color="#689581",
text_color="#c5ae94")
name2.pack(pady=10)
b2=c.CTkButton(root,text="Enter",
height=90,
width=200,
text_color='black',
font=('Comic Sans MS',30,'bold'),
border_color='white',
fg_color='#689581',
hover_color='#c5ae94',command=enter2)
b2.pack(pady=60)
rk=c.CTkLabel(root,text="CLOSE THE WINDOW TO \n ENTER TO THE MENU PAGE",font=('Comic Sans MS',21,"bold"),text_color='#c5ae94')
rk.pack(pady=250)
root.mainloop()
import tkinter as tk
from tkinter import Listbox,scrolledtext, messagebox, ttk,Scrollbar
import mysql.connector
import webbrowser
import random
import threading
import time
from datetime import datetime,timedelta
class CarebearApp:
def __init__(self, master):
self.master = master
master.title("Carebear")
l=tk.Label(master, text="CAREBEAR: Menu",font=("Helvetica",14,"bold"),bg="#689581")
l.pack(pady=20)
self.exercise_button = tk.Button(master, text="Exercise Routine", command=self.open_exercise_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.affirmations_button = tk.Button(master, text="Daily Affirmations", command=self.open_affirmations_app, bg="#689581")
self.affirmations_button.pack(pady=10)
self.healthy_food_button = tk.Button(master, text="Healthy Food Recommendations", command=self.open_healthy_food_app, bg="#689581")
self.healthy_food_button.pack(pady=10)
self.relaxation_button = tk.Button(master, text="Relaxation Techniques", command=self.open_relaxation_app, bg="#689581")
self.relaxation_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Chatbot", command=self.open_chatbot_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Self-care tips", command=self.open_selfcaretips_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="To do lists", command=self.open_todolists_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Self-care Journal", command=self.open_selfcarejournal_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Library of meditations", command=self.open_meditation_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Mood tracker", command=self.open_moodtracker_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Human Support Community", command=self.open_community_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Self-care Podcasts", command=self.open_podcasts_app, bg="#689581")
self.exercise_button.pack(pady=10)
self.exercise_button = tk.Button(master, text="Sleep tracker", command=self.open_sleeptracker_app, bg="#689581")
self.exercise_button.pack(pady=10)
def open_community_app(self):
community=tk.Toplevel(self.master)
Community(community)
def open_podcasts_app(self):
podcasts=tk.Toplevel(self.master)
Podcasts(podcasts)
def open_sleeptracker_app(self):
sleeptracker_window=tk.Toplevel(self.master)
SleepTracker(sleeptracker_window)
def open_meditation_app(self):
meditations_window=tk.Toplevel(self.master)
Meditations(meditations_window)
def open_selfcaretips_app(self):
selfcaretips_window=tk.Toplevel(self.master)
Selfcaretips(selfcaretips_window)
def open_selfcarejournal_app(self):
selfcarejournal_window=tk.Toplevel(self.master)
Selfcarejournal(selfcarejournal_window)
def open_todolists_app(self):
todolists_window=tk.Toplevel(self.master)
Todolist(todolists_window)
def open_chatbot_app(self):
chatbot_window=tk.Toplevel(self.master)
Chatbot(chatbot_window)
def open_exercise_app(self):
exercise_window = tk.Toplevel(self.master)
ExerciseApp(exercise_window)
def open_affirmations_app(self):
affirmations_window = tk.Toplevel(self.master)
DailyAffirmationsApp(affirmations_window)
def open_healthy_food_app(self):
healthy_food_window = tk.Toplevel(self.master)
HealthyFoodApp(healthy_food_window)
def open_relaxation_app(self):
relaxation_window = tk.Toplevel(self.master)
RelaxationApp(relaxation_window)
def open_moodtracker_app(self):
moodtracker_window =tk.Toplevel(self.master)
Moodtracker(moodtracker_window)
class Podcasts:
def __init__(self, root):
self.root = root
self.root.title("Carebear:Self-Care Podcasts")
self.podcast_list = [
{"title": "Life Kit", "url": "https://podcasts.apple.com/us/podcast/life-kit/id1461493560"},
{"title": "Not another anxiety show", "url": "https://podcasts.apple.com/us/podcast/not-another-anxiety-show/id1175495815"},
{"title": "The joy of procrastination", "url": "https://www.joyofprocrastination.com/podcast/001"},
{"title": "The recovery warrior show", "url": "https://podcasts.apple.com/za/podcast/the-recovery-warrior-shows/id881265212"}
]
self.create_widgets()
def create_widgets(self):
self.label = tk.Label(self.root, text="Choose a Self-Care Podcast:",bg="#689581")
self.label.pack(pady=10)
self.podcast_listbox = Listbox(self.root, selectmode=tk.SINGLE, width=40,bg="#689581")
for podcast in self.podcast_list:
self.podcast_listbox.insert(tk.END, podcast["title"])
self.podcast_listbox.pack(pady=10)
scrollbar = Scrollbar(self.root, orient=tk.VERTICAL)
scrollbar.config(command=self.podcast_listbox.yview)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
self.podcast_listbox.config(yscrollcommand=scrollbar.set)
self.play_button = tk.Button(self.root, text="Play Podcast", command=self.play_podcast,bg="#689581")
self.play_button.pack(pady=10)
def play_podcast(self):
selected_index = self.podcast_listbox.curselection()
if selected_index:
selected_podcast = self.podcast_list[selected_index[0]]
podcast_url = selected_podcast["url"]
webbrowser.open_new(podcast_url)
class SleepTracker:
def __init__(self, root):
self.root = root
self.root.title("Carebear: Sleep Tracker")
self.create_widgets()
# Create the database and table when the application starts
self.create_database()
self.create_table()
# Create the database if it doesn't exist
def create_database(self):
try:
# Establish the MySQL connection (without specifying a database initially)
connection = mysql.connector.connect(
host='localhost',
user='root', # your MySQL username
password='root12345' # your MySQL password
)
cursor = connection.cursor()
# Create the database if it doesn't exist
cursor.execute("CREATE DATABASE IF NOT EXISTS sleep_tracker")
connection.commit()
except mysql.connector.Error as err:
messagebox.showerror("Database Error", f"Error: {err}")
except Exception as e:
messagebox.showerror("Error", f"An unexpected error occurred: {e}")
finally:
if connection.is_connected():
connection.close()
# Create the table if it doesn't exist
def create_table(self):
try:
# Establish the MySQL connection with the specific database
connection = mysql.connector.connect(
host='localhost',
user='root',
password='root12345',
database='sleep_tracker'
)
cursor = connection.cursor()
# Create the table if it doesn't exist
query = """
CREATE TABLE IF NOT EXISTS sleep_records (
id INT AUTO_INCREMENT PRIMARY KEY,
start_time DATETIME,
end_time DATETIME,
quality VARCHAR(10),
duration FLOAT
);
"""
cursor.execute(query)
connection.commit()
except mysql.connector.Error as err:
messagebox.showerror("Database Error", f"Error: {err}")
except Exception as e:
messagebox.showerror("Error", f"An unexpected error occurred: {e}")
finally:
if connection.is_connected():
connection.close()
# Insert sleep record into the database
def insert_sleep_record(self, start, end, quality, duration):
try:
# Establish the MySQL connection
connection = mysql.connector.connect(
host='localhost',
user='root',
password='root12345',
database='sleep_tracker'
)
cursor = connection.cursor()
query = "INSERT INTO sleep_records (start_time, end_time, quality, duration) VALUES (%s, %s, %s, %s)"
cursor.execute(query, (start, end, quality, duration))
connection.commit()
messagebox.showinfo("Success", "Sleep record inserted successfully!")
except mysql.connector.Error as err:
messagebox.showerror("Database Error", f"Error: {err}")
except Exception as e:
messagebox.showerror("Error", f"An unexpected error occurred: {e}")
finally:
if connection.is_connected():
connection.close()
# Add sleep record - user provides duration and quality
def add_sleep_record(self):
duration = self.sleep_duration_entry.get() # Getting the sleep duration entered by the user
quality = self.quality_of_sleep_var.get() # Getting the selected quality of sleep
# Validate duration input (should be a positive number)
if not duration.isdigit() or float(duration) <= 0:
messagebox.showerror("Invalid Input", "Please enter a valid sleep duration (positive number).")
return
try:
# Current time as start time
start_time = datetime.now()
# Calculate end time based on sleep duration
end_time = start_time + timedelta(hours=float(duration))
# Insert into database
self.insert_sleep_record(start_time, end_time, quality, duration)
except ValueError:
messagebox.showerror("Invalid Input", "Error while processing your input.")
# Fetch all records from the database and show them in a scrolling text area
def show_records(self):
try:
# Establish the MySQL connection
connection = mysql.connector.connect(
host='localhost',
user='root',
password='root12345',
database='sleep_tracker'
)
cursor = connection.cursor()
# Fetch all sleep records
query = "SELECT * FROM sleep_records"
cursor.execute(query)
records = cursor.fetchall()
# Clear the text area before inserting new data
self.records_text.delete(1.0, tk.END)
# Check if there are any records
if not records:
self.records_text.insert(tk.END, "No sleep records found.")
else:
# Display records in the text area
for record in records:
record_text = f"ID: {record[0]}\nStart Time: {record[1]}\nEnd Time: {record[2]}\nQuality: {record[3]}\nDuration: {record[4]} hours\n\n"
self.records_text.insert(tk.END, record_text)
except mysql.connector.Error as err:
messagebox.showerror("Database Error", f"Error: {err}")
except Exception as e:
messagebox.showerror("Error", f"An unexpected error occurred: {e}")
finally:
if connection.is_connected():
connection.close()
# Create and place widgets on the window
def create_widgets(self):
self.l = tk.Label(self.root, text="How many hours did you sleep?", font=("Arial", 12))
self.l.pack(pady=10)
self.sleep_duration_entry = tk.Entry(self.root, width=25, font=("Arial", 12))
self.sleep_duration_entry.pack(pady=5)
self.l1 = tk.Label(self.root, text="How was the quality of your sleep?", font=("Arial", 12))
self.l1.pack(pady=10)
# Dropdown for sleep quality options
self.quality_of_sleep_var = tk.StringVar(self.root)
self.quality_of_sleep_var.set("Good") # Default value
quality_options = [
"Excellent", # Ideal, high-quality sleep
"Good", # Good but not perfect sleep
"Fair", # Average quality, could be better
"Poor", # Below average, could use improvement
"Restful", # Sleep felt refreshing and undisturbed
"Disturbed", # Sleep was interrupted or restless
"Very Poor", # Sleep was very poor, woke up tired
"Tired", # Woke up feeling tired and unrested
"Refreshed", # Felt well-rested and energized
"Unsettled" # Sleep felt uneasy or fragmented
]
self.quality_dropdown = tk.OptionMenu(self.root, self.quality_of_sleep_var, *quality_options)
self.quality_dropdown.pack(pady=5)
self.b = tk.Button(self.root, text="Add Sleep Record", command=self.add_sleep_record, bg="#689581", font=("Arial", 12))
self.b.pack(pady=20)
# Button to show records
self.show_button = tk.Button(self.root, text="Show Records", command=self.show_records, bg="#689581", font=("Arial", 12))
self.show_button.pack(pady=10)
# ScrolledText widget to display records
self.records_text = scrolledtext.ScrolledText(self.root, width=60, height=15, wrap=tk.WORD, font=("Arial", 10))
self.records_text.pack(pady=20)
class Community:
def __init__(self, root):
self.root = root
self.root.title("Carebear:Human Support Community")
self.messages = []
self.create_widgets()
def create_widgets(self):
self.label = tk.Label(self.root, text="Human Support Community", font=('Helvetica', 16, 'bold'),bg="#c5ae94")
self.label.pack(pady=10)
self.message_display = scrolledtext.ScrolledText(self.root, width=70, height=15, wrap=tk.WORD,bg="#c5ae94")
self.message_display.pack(padx=10, pady=10)
self.message_entry = tk.Entry(self.root, width=70,bg="#c5ae94")
self.message_entry.pack(pady=10)
self.post_button = tk.Button(self.root, text="Post Message", command=self.post_message,bg="#c5ae94")
self.post_button.pack(pady=5)
self.clear_button = tk.Button(self.root, text="Clear Messages", command=self.clear_messages,bg="#c5ae94")
self.clear_button.pack(pady=5)
def post_message(self):
message_text = self.message_entry.get()
if message_text:
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
username = "You"
formatted_message = f"{timestamp} - {username}: {message_text}"
self.messages.append(formatted_message)
self.update_message_display()
self.message_entry.delete(0, tk.END)
def clear_messages(self):
self.messages = []
self.update_message_display()
def update_message_display(self):
self.message_display.config(state=tk.NORMAL)
self.message_display.delete(1.0, tk.END)
for message in self.messages:
self.message_display.insert(tk.END, f"{message}\n\n")
self.message_display.config(state=tk.DISABLED)
self.message_display.see(tk.END)
class Meditations:
def __init__(self, root):
self.root = root
self.root.title("Carebear: Library of meditations")
self.meditation_time = 300
self.timer_running = False
self.label = tk.Label(root, text="Instructions:\n1.Click on 'start meditation' to start the timer for ur meditation.\n 2.You have 5 minutes timer for ur mediation.", font=("Helvetica", 16),bg="#689581")
self.label.pack(pady=10)
self.label = tk.Label(root, text="Meditation methods:\n \n Loving-Kindness Meditation (Metta):\n Description:\n Metta meditation involves generating feelings of love and compassion \n towards oneself and others. It often includes repeating phrases that \n express goodwill.\n How to Practice:\n Sit in a comfortable position, close your eyes, and silently repeat phrases \n like 'May I/you be happy, may I/you be healthy.' \n Body Scan Meditation:\n Description:\n This meditation involves bringing focused \n attention to different parts of the body, typically starting \n from the toes and moving up to the head. \n How to Practice:\n Lie down or sit comfortably. Bring attention to each \n part of your body, noticing sensations without judgment.\n Zen Meditation (Zazen): \n Description:\n Zazen is a form of seated meditation practiced in Zen Buddhism. It emphasizes \n proper posture, breath awareness, and maintaining a clear, focused mind. \n How to Practice:\n Sit on a cushion or chair with a straight back. Focus on \n your breath or an aspect of your present experience.", font=("Helvetica", 10,"bold"),bg="#689581")
self.label.pack(pady=10)
self.label = tk.Label(root, text="Meditation Timer", font=("Helvetica", 16),bg="#689581")
self.label.pack(pady=10)
self.timer_label = tk.Label(root, text="", font=("Helvetica", 20),bg="#689581")
self.timer_label.pack(pady=20)
self.start_button = tk.Button(root, text="Start Meditation", command=self.start_meditation,bg="#689581")
self.start_button.pack(pady=10)
self.root.mainloop()
def start_meditation(self):
if not self.timer_running:
self.timer_running = True
self.start_button["state"] = "disabled"
self.update_timer()
def update_timer(self):
if self.meditation_time > 0 and self.timer_running:
self.display_time()
self.meditation_time -= 1
self.root.after(1000, self.update_timer)
else:
self.timer_running = False
self.start_button["state"] = "normal"
messagebox.showinfo("Meditation Complete", "Your meditation session is complete.")
def display_time(self):
minutes, seconds = divmod(self.meditation_time, 60)
time_str = f"{minutes:02d}:{seconds:02d}"
self.timer_label.config(text=time_str)
class Selfcarejournal:
def __init__(self, root):
self.root = root
self.root.title("Carebear:Self-Care Journal")
self.create_widgets()
def create_widgets(self):
self.entry_label = tk.Label(self.root, text="Write your journal entry:",font=("Helvetica",14,"bold"),bg="#689581")
self.entry_label.pack(pady=20)
self.entry_text = scrolledtext.ScrolledText(self.root, width=40, height=10, wrap=tk.WORD,bg="#689581",font=("Helvetica",10,"bold"))
self.entry_text.pack(pady=30)
self.save_button = tk.Button(self.root, text="Save Entry", command=self.save_entry,bg="#689581")
self.save_button.pack(pady=20)
self.view_button = tk.Button(self.root, text="View Entries", command=self.view_entries,bg="#689581")
self.view_button.pack(pady=20)
def save_entry(self):
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
entry_text = self.entry_text.get("1.0", tk.END)
journal_entry = f"{current_time}:\n{entry_text}\n"
with open("journal_entries.txt", "a") as file:
file.write(journal_entry)
self.entry_text.delete("1.0", tk.END)
def view_entries(self):
view_window = tk.Toplevel(self.root)
view_window.title("View Entries")
view_text = scrolledtext.ScrolledText(view_window, width=40, height=20, wrap=tk.WORD,bg="#c5ae94")
view_text.pack(pady=10)
try:
with open("journal_entries.txt", "r") as file:
entries = file.read()
view_text.insert(tk.END, entries)
except FileNotFoundError:
view_text.insert(tk.END, "No entries found.")
class Selfcaretips:
def __init__(self, root):
self.root = root
self.root.title("Carebear: Self-Care Tips")
self.tips = [
"'Take a deep breath and relax.'",
"'Go for a walk in nature.'",
"'Practice mindfulness meditation.'",
"'Get a nap.'",
"'Read a book or watch a movie you enjoy.'",
"'Take a break and do something you love.'",
"'Write down your thoughts.'",
"'Exercise to boost your mood.'",
"'Connect with a friend or loved one.'",
"'Listen to your favorite music.'",
"'Eat something which you crave for.'",
"Spend time alone doing things you enjoy. It's essential to recharge and reflect without external distractions.",
"Practice positive self-talk. Remind yourself of your strengths and achievements, fostering a positive mindset",
"Take time for self-reflection. Understand your emotions, set goals, and identify areas of your life that may need attention."
]
l=tk.Label(root,text="Feeling stressed or low!! Here's some self care tips to follow to make you calm:",font=("Helvetica",17,"bold"),justify="center",wraplength=400,bg="#c5ae94")
l.pack(pady=60)
self.tip_label = tk.Label(root, text="", font=("Helvetica", 19,"bold italic"), wraplength=300, justify="center",bg="#c5ae94")
self.tip_label.pack(pady=30)
self.show_tip_button = tk.Button(root, text="Show Self-Care Tip", command=self.show_tip,bg="#c5ae94")
self.show_tip_button.pack(pady=30)
def show_tip(self):
random_tip = random.choice(self.tips)
self.tip_label.config(text=random_tip)
class Todolist:
def __init__(self, root):
self.root = root
self.root.title("Carebear: To-Do List")
self.tasks = []
self.task_label = tk.Label(root, text="Enter Task:",bg="#c5ae94",font=("Helvetica",15,"bold"))
self.task_entry = tk.Entry(root, width=30,bg="#c5ae94")
self.task_listbox = tk.Listbox(root, width=50, height=15,bg="#c5ae94")
self.add_button = tk.Button(root, text="Add Task", command=self.add_task,bg="#c5ae94")
self.remove_button = tk.Button(root, text="Remove Task", command=self.remove_task,bg="#c5ae94")
self.mark_complete_button = tk.Button(root, text="Mark as Complete", command=self.mark_as_complete,bg="#c5ae94")
self.task_label.pack(pady=15)
self.task_entry.pack(pady=15)
self.add_button.pack(pady=5)
self.task_listbox.pack(pady=20)
self.remove_button.pack(pady=10)
self.mark_complete_button.pack(pady=10)
def add_task(self):
task = self.task_entry.get().strip()
if task:
self.tasks.append({"task": task, "status": "Incomplete"})
self.update_task_list()
self.task_entry.delete(0, tk.END)
else:
messagebox.showwarning("Warning", "Task cannot be empty!")
def remove_task(self):
selected_task_index = self.task_listbox.curselection()
if selected_task_index:
self.tasks.pop(selected_task_index[0])
self.update_task_list()
else:
messagebox.showwarning("Warning", "Please select a task to remove!")
def mark_as_complete(self):
selected_task_index = self.task_listbox.curselection()
if selected_task_index:
selected_index = selected_task_index[0]
self.tasks[selected_index]["status"] = "Complete"
self.update_task_list()
else:
messagebox.showwarning("Warning", "Please select a task to mark as complete!")
def update_task_list(self):
self.task_listbox.delete(0, tk.END)
for task_info in self.tasks:
task = task_info["task"]
status = task_info["status"]
self.task_listbox.insert(tk.END, f"{task} - Status: {status}")
class Chatbot:
def __init__(self, master):
self.master = master
master.title("Carebear: Chatbot")
self.label_instructions = tk.Label(master, text="Type a message and press 'Send'", bg="#689581", fg="white")
self.label_instructions.pack(pady=10)
self.chat_history = scrolledtext.ScrolledText(master, width=50, height=20, state='disabled', bg="#c5ae94")
self.chat_history.pack(padx=10, pady=10)
self.user_input = tk.Entry(master, width=50, bg="#c5ae94")
self.user_input.pack(padx=10, pady=10)
self.send_button = tk.Button(master, text="Send", command=self.send_message, bg="#c5ae94")
self.send_button.pack(pady=10)
master.protocol('WM_DELETE_WINDOW', self.on_close)
def send_message(self):
user_message = self.user_input.get().lower()
if user_message.strip() != "":
self.display_message("You: " + user_message)
chatbot_response = self.get_chatbot_response(user_message)
self.display_message("Chatbot: " + chatbot_response)
self.user_input.delete(0, 'end')
else:
self.display_message("You: Please enter a valid message.")
def get_chatbot_response(self, user_message):
keyword_responses = {
"hello": "Hello! How can I help you today?",
"how are you": "I'm just a chatbot, but thanks for asking!",
"hi":"Hello! How can I help you today?",
"self-care": self.get_self_care_prompt(),
"motivation": "You're capable of achieving great things! What's your goal today?",
"inspire me": "Believe in yourself and all that you are. You are stronger than you think.",
"joke": "Sure, here's a joke: Why don't scientists trust atoms? Because they make up everything!",
"stress": self.stress(),
"mental":self.depress(),
"thank you": "You're welcome! If you need more assistance, feel free to ask.",
"good morning": "Good morning! Wishing you a wonderful day ahead.",
"good night": "Good night! Have a restful sleep.",
"thank you": "You're welcome! If you have more questions, feel free to ask.",
"bye": "Goodbye! Take care and remember to practice self-care!",
"music": "Listening to music can be a great way to relax. What genre do you enjoy?",
"exercise": "Consider taking a short walk or doing some light exercises to boost your energy.",
"hobbies": "What are your favorite hobbies? Engaging in activities you love can be a form of self-care.",
"weather": "The weather can affect our mood. How does the weather make you feel today?",
"inspiration": "Think about a goal you want to achieve and take a small step towards it today.",
"gratitude": "List three things you're grateful for right now.",
"motivation": "What motivates you? Focus on that to boost your energy!",
"positivity": "Surround yourself with positive thoughts and people. What's something positive in your day?",
"chatbot": "I'm a friendly chatbot designed to provide support and encouragement.",
"learn": "Continuous learning is a great way to keep your mind active and engaged.",
"fun fact": "Did you know that chatbots use natural language processing to understand and respond to text?",
"not feeling ok": self.stress(),
"tense": self.stress(),
"anxiety": self.stress(),
"depress": self.depress()
}
for keyword, response in keyword_responses.items():
if keyword in user_message:
return response
return "I'm not sure how to respond to that. Please ask me something else."
def get_self_care_prompt(self):
self_care_prompts = [
"Take a deep breath and relax for a moment.",
"What's something you're grateful for today?",
"Do something kind for yourself today.",
"Take a break and stretch your body.",
"Remind yourself of a past achievement you're proud of.",
"Think of someone who makes you happy.",
"Visualize a place that brings you peace and calmness.",
]
return random.choice(self_care_prompts)
def depress(self):
depressprompts=[
"I'm really sorry to hear that you're feeling this way. It's important to talk to someone you trust about what you're going through.",
"I'm here for you. If you're comfortable, try reaching out to friends, family, or a mental health professional who can provide support.",
"It's okay not to be okay. Consider sharing your feelings with someone you trust, and remember that seeking professional help is a sign of strength.",
"I'm here to chat, but it's crucial to talk to someone who can provide the support you need. Reach out to friends, family, or a mental health professional.",
"Depression can be overwhelming, but you don't have to face it alone. Talking to others or seeking professional help can make a significant difference.",
"I'm not a substitute for professional help, but I encourage you to reach out to a mental health professional or someone you trust to discuss your feelings.",
"Taking small steps to prioritize your mental health can make a big difference. Consider talking to a mental health professional or someone you trust about what you're going through.",
"Remember that you're not alone in this. There are people who care about you and resources available to support you. Reach out to someone you trust.",
"Always encourage users to seek help from qualified professionals or support networks, especially when dealing with sensitive topics like depression. If someone is in crisis, it's important to provide resources for immediate assistance, such as helplines or emergency services."
]
return random.choice(depressprompts)
def stress(self):
stressprompts=[
"Take slow, deep breaths to calm your nervous system. Focus on your breath and try to clear your mind.",
"Physical activity is a great stress reliever. Whether it's a brisk walk, a run, or a workout, exercise helps release endorphins, which are natural mood lifters.",
"Practice mindfulness or meditation to bring your attention to the present moment. This can help reduce stress and anxiety.",
"Step away from the source of stress, even if it's just for a few minutes. Take a short walk, stretch, or do something enjoyable to reset your mind.",
"Share your feelings with a friend or family member. Sometimes, talking about what's stressing you can provide relief.",
"Choose calming or uplifting music that you enjoy. Music has the power to influence mood and can be a great stress reducer.",
"Engage in activities you love. Whether it's reading, drawing, gardening, or any other hobby, doing something you enjoy can take your mind off stress.",
"Both caffeine and sugar can contribute to increased stress levels. Consider reducing your intake, especially during stressful times.",
"Lack of sleep can contribute to stress. Ensure you're getting enough rest to support your overall well-being.",
" Watch a funny movie, TV show, or spend time with people who make you laugh. Laughter can be a great way to relieve stress.",
"Break down tasks into smaller, manageable steps. Prioritize what needs to be done, and create a plan to tackle tasks one at a time.",
"Write down your thoughts and feelings. Journaling can help you gain clarity and perspective on the things that are causing stress.",
"Certain scents, like lavender or chamomile, are known for their calming effects. Consider using essential oils or candles to create a relaxing environment.",
"Don't overcommit yourself. It's okay to say no to additional responsibilities if you're feeling overwhelmed.",
"If stress becomes chronic or overwhelming, consider seeking support from a mental health professional.",
]
return random.choice(stressprompts)
def display_message(self, message):
self.chat_history.config(state='normal')
self.chat_history.insert('end', message + '\n')
self.chat_history.config(state='disabled')
self.chat_history.yview(tk.END)
def on_close(self):
self.master.destroy()
class DailyAffirmationsApp:
def __init__(self, master):
self.master = master
master.title("Carebear: Daily Affirmations")
self.affirmations = [
"I am worthy of love and respect.",
"I choose happiness over fear.",
"I am becoming the best version of myself.",
"My potential is limitless.",
"I am confident in my abilities.",
"Every challenge I face is \n an opportunity to grow.",
"I trust in the process of life.",
"I am surrounded by positive energy.",
"My mind is full of gratitude \n for the present moment.",
"I let go of all that \n no longer serves me.",
"I am resilient and can \n overcome any obstacle.",
"I am at peace with my past \n and excited for my future.",
"My thoughts create my reality, \n and I choose positive thoughts.",
"I radiate love and compassion.",
"I am worthy of all the good \n things life has to offer.",
"I am a loving and lovable person.",
"I am attracting positive opportunities into my life.",
"I am blessed with an abundance \n of health, wealth, and happiness.",
"I am a magnet for positive experiences.",
"I am grateful for the abundance in my life.",
"I am deserving of love and affection.",
"I am attracting love, joy, \n and abundance into my life.",
"I am filled with positive \n energy and vitality.",
"I am surrounded by beauty and grace.",
"I am a unique and valuable person.",
"I am a loving and compassionate soul.",
"I am worthy of all the good \n things life has to offer.",
"I am constantly growing and evolving.",
"I am creating a life filled with joy and abundance.",
"I am the master of my own destiny.",
"I am capable of achieving greatness.",
"I am attracting positive energy into my life.",
"I am grateful for the gift of life.",
"I am at peace with who I am.",
"I am constantly evolving and growing.",
"I am attracting positive opportunities into my life.",
"I am surrounded by love and positivity.",
"I am worthy of love and affection.",
"I am a vessel of love and light.",
"I am a magnet for positive energy.",
"I am in control of my own happiness.",
"I am grateful for the abundance in my life.",
"I am deserving of success and prosperity.",
"I am capable of achieving my goals.",
"I am a powerful and confident individual.",
"I am surrounded by love and positive energy.",
"I am a beacon of light and positivity.",
"I am deserving of all the good \n things life has to offer.",
"I am creating a life filled with joy and abundance.",
"I am grateful for the love and joy in my life.",
"I am a source of inspiration for others.",
"I am at peace with my past and \n excited for my future.",
"I am open to new and exciting possibilities.",
"I am creating the life of my dreams.",
"I am confident in my abilities and talents.",
"I am worthy of success and happiness.",
"I am a beacon of positivity and light.",
"I am deserving of all the \n good things life has to offer.",
"I am a magnet for abundance and prosperity.",
"I am a loving and compassionate person.",
"I am grateful for the gift of life.",
"I am at peace with who I am.",
"I am constantly evolving and growing.",
"I am attracting positive \n opportunities into my life.",
"I am surrounded by love and positivity.",
"I am worthy of love and affection.",
"I am a vessel of love and light.",
"I am a magnet for positive energy.",
"I am worthy of success and happiness.",
"I am a beacon of positivity and light.",
"I am a magnet for abundance and prosperity.",
"I am a loving and compassionate person.",
"I am grateful for the gift of life.",
"I am at peace with who I am.",
"I am constantly evolving and growing.",
"I am attracting positive \n opportunities into my life.",
"I am surrounded by love and positivity.",
"I am worthy of love and affection.",
"I am a vessel of love and light.",
"I am a magnet for positive energy.",
"I am in control of my own happiness.",
"I am grateful for the abundance in my life.",
"I am deserving of success and prosperity.",
"I am a source of love and \n inspiration for others.",
"I am capable of achieving my goals.",
"I am a powerful and confident individual.",
"I am surrounded by love \n and positive energy.",
]
self.current_affirmation = tk.StringVar()
self.current_affirmation.set(random.choice(self.affirmations))
self.affirmation_label = tk.Label(master, textvariable=self.current_affirmation, font=("Helvetica", 14),bg="#c5ae94")
self.affirmation_label.pack(padx=10, pady=190)
self.new_affirmation_button = tk.Button(master, text="New Affirmation", command=self.generate_affirmation,bg="#c5ae94")
self.new_affirmation_button.pack(pady=10)
def generate_affirmation(self):
new_affirmation = random.choice(self.affirmations)
self.current_affirmation.set(new_affirmation)
class ExerciseApp:
def __init__(self, master):
self.master = master
self.master.title("Carebear: Daily Exercises")
self.master.geometry("400x700")
self.create_widgets()
def create_widgets(self):
self.label = tk.Label(self.master, text="INSTRUCTIONS:\n 1.There are four installed exercises \n (Jumping Jacks,Squats,Pushups,Planks) \n 2.Each is set for 1 minute \n 3.You have 30 seconds of rest interval \n 4.You are given a extra 'Own Exercise' in which you \n can wish to do the exercise of your own choice",bg="#c5ae94",font=("Helvetica",13,"bold"))
self.label.pack(pady=30)
self.label = tk.Label(self.master, text="Daily Exercises",bg="#c5ae94",font=("Helvetica",15,"bold"))
self.label.pack(pady=30)
self.progressbar = ttk.Progressbar(self.master, orient="horizontal", length=300, mode="determinate")
self.progressbar.pack(pady=20)
self.exercises = [
{"name": "Jumping Jacks", "duration": 60},
{"name": "Squats", "duration": 60},
{"name": "Push-Ups", "duration": 60},
{"name": "Plank", "duration": 60},
{"name": "Own Exercise", "duration": 60}
]
self.current_exercise_index = 0
self.start_button = tk.Button(self.master, text="Start Exercises", command=self.start_exercises,bg="#c5ae94")
self.start_button.pack(pady=40)
def start_exercises(self):
threading.Thread(target=self.run_exercises).start()
def run_exercises(self):
for exercise in self.exercises:
exercise_name = exercise["name"]
exercise_duration = exercise["duration"]
messagebox.showinfo("Get Ready", f"Get ready for {exercise_name}!")
self.label.config(text=f"Starting {exercise_name}...")
self.progressbar["value"] = 0
self.run_countdown(exercise_duration, exercise_name)
rest_duration = 30
self.label.config(text=f"Resting for {rest_duration} seconds...")
self.progressbar["value"] = 0
self.run_countdown(rest_duration, "Rest Interval")
self.label.config(text="All exercises complete!")
self.progressbar["value"] = 0
def run_countdown(self, duration, exercise_name):
for i in range(duration, -1, -1):
time.sleep(1)
self.label.config(text=f"{exercise_name} - {i} seconds left")