Hello everyone! We are going to learn how we can make a reminder application using Python. You can make your "drink water reminder" application or you can make “take a break reminder application”. I will share two ways first, for Mac users and the second one for Windows users.
First, we will see how you can make your reminder application if you are a Mac user.
For Mac Users
For Mac users, we are going to use the pync library. We will divide our code into two parts — in the first part, we will import all required libraries, and in the second part, we will write the code for the reminder.
Here’s the first step.
Step no.1
First, we need to install pync in our system. So, we will use the below command:
pip install pync
Now we will use this library
import pync
import time
Now, the second step:
Step no.2
def reminder():
pync.notify(title = “break reminder”, message=”hello sir please take some break from work”,timeout = 1)
while True:
reminder()
time.sleep(10)
Here, we have created a reminder function and in that reminder function, we have used the notify function. With the help of the notify function, we have defined the message, and also, we can define the timeout (which will define how much time the notification will stay on screen).
And at the end, we have created a while loop so that our program will run after every 10 seconds.
Full code:
For Windows Users
So, now for Windows users.
We are going to use the plyer library. We will divide our code into two parts. In the first part, we will import all required libraries, and in the second part, we will write the code for the reminder.
So, here is the first step.
Step no.1
First, we need to install pync in our system so we will use the below command:
pip install plyer
Now, we will use this library:
From plyer import notification
import time
Now, the second step.
Step no.2
def reminder():
notification.notify(title = “break reminder”, message=”hello sir please take some break from work”,timeout = 1)
while True:
reminder()
time.sleep(10)
I hope you have understood the whole code. You can also check out the video tutorial:
That's it for this topic. Thanks for reading.