The idea behind this article is to create a notification system that reminds the user to drink water after a fixed interval of time. The program coded below first asks its user to input time interval for notification. Then until user ends script, it sends repeated notifications to user to drink water. After each interval it creates a text file which contains a log of when user drank water.
- time: To manage the interval time.
- win10Toast : To send quick notification.
- datetime : To keep record of time and date in log.
- Import module
- Get time interval from the user, it asks user to input hour, minutes and seconds
- Convert them to seconds and return time to main function.
- Add loop to start timer and generate a toast message when timer reaches the set time
- After sending notification program will call to function to write log file. This function will get current time and date
- Create a .txt file and append drink water log to it.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course