Healthy Habits
Reminder
Section :CSE5
Sathwik Roll no: 24261A05U1
Sanjana 24261A05V1
Gurvinder 24261A05U8
contents:
[Link]
[Link] code
[Link]
Introduction:
• The program is designed to remind users to follow healthy habits like drinking
water, exercising, and taking breaks—especially helpful for students and computer
users.
• In our busy routines, we often forget small but important habits. This program
helps us stay consistent with our health goals.
• It runs on a schedule and gives regular pop-up or sound alerts for different tasks
like "Drink Water" or "Take a Short Walk."
• It's perfect for students, teachers, or anyone who spends long hours studying or
working at a desk.
Source code:
import tkinter as tk
from tkinter import messagebox
import time
import threading
Explanation:
1. 'tkinter` is Python's standard GUI library.
2. `messagebox` allows pop-up dialog boxes.
3. `time` is used for delays/sleep intervals.
4. `threading` allows running code in parallel to avoid blocking
# List of positive habit reminders
reminders = [
"Take a deep breath and smile ��",
"Sit up straight and fix your posture ��",
"Drink a glass of water ��",
"Take a 1-minute stretch break ��",
"Think of one thing you're grateful for ��",
"Step away from the screen for a bit �� ",
]
Explanation:
This is a list of strings. Each string is a positive habit reminder.
# Interval in minutes
REMINDER_INTERVAL = 1
def show_reminder():
# Pick a random reminder from the list
import random
reminder = [Link](reminders)
# Create a popup window
root = [Link]()
[Link]() # Hide the main tkinter window
[Link]("Positive Habit Reminder", reminder)
[Link]()
Explanation:
`[Link](reminders)` selects a random reminder.
`[Link]()` creates a main GUI window.
`[Link]()` hides that window (you only want the pop-up).
`[Link](...)` displays the reminder in a pop-up.
def start_reminder_loop():
while True:
[Link](REMINDER_INTERVAL * 60) # Wait for the interval
show_reminder()
Explanation:
Runs forever in a loop.
- `[Link](...)` pauses the loop for the defined interval.
- After the wait, it shows a reminder.
GUI
# Run the reminder in a separate thread so it doesn't block the
or terminal
reminder_thread = [Link](target=start_reminder_loop,
daemon=True)
reminder_thread.start()
Explanation:
This creates a new thread to run `start_reminder_loop()` in the
background.
`daemon=True` means it will close when the main program exits.
`.start()` begins the thread execution.
# Keep the script running
print("Positive Habit Reminder is running. Press Ctrl+C to stop.")
while True:
[Link](1)
Explanation:
Displays a message that the program is running.
A `while True` loop keeps the script alive by sleeping 1 second at a time.
Without this, the script would end and stop the thread.
Execution:
• When executed , The habits
reminder pop ups with
specified interval.
• Press 'Ok' button to exit the
reminder tab.
• The same reminder tab will
reappear with specified time
interval .
• In this way we can maintain
healthy habits.
• To exit the program press
'CTRL+C'
Thank you