Create Desktop Notifier using Python
In this blog article, we will learn how to send Desktop notifications. We will see the implementation in Python.
What will be covered in this Blog
1. Desktop Notification Introduction
2. What is Plyer?
3. Create a Desktop Notifier
the action of notifying someone or something.
The purpose behind a notification is to inform about an event and encourage him to take action.
Notifications help people to remember things. It is a small piece of text which appears on the desktop or mobile screen to inform the user about the updates or any other important pieces of information.
What is Plyer?
Plyer is a Python library for accessing features of your hardware/platforms.
If you wish to know more about it, you can refer to Plyer Documentation. Use this link to navigate to the documentation.
Other areas where you can use this approach
- Set daily tracker for COVID stats
- Daily notification to take medicine.
- Hourly notification to drink water.
and many more, it’s completely up to you how to use this application.
Now that you are aware of Desktop Notification and Plyer basics, we can move forward to the coding section.
Time to code!
Open your terminal and run the following command
pip install plyer
Now that we have the package, we are ready to import it in our python script.
from plyer import notification
Now let’s specify the parameters. Let's define the
title = 'Hello Amazing people!'message= 'Thankyou for reading! Take care!'
Let’s look at what the parameters mean:
title: Title of the notification
message: Message of the notification
app_name: Name of the app launching this notification
app_icon: Icon to be displayed along with the message
timeout: time to display the message for, defaults to 10
ticker: text to display on the status bar as the notification arrives
toast: simple message instead of full notification
Now, let’s pass the parameters using
app_icon = None,
I am passing:
titleas `'Hello Amazing people!'``
'Thankyou for reading! Take care!'
That’s it! We are done. Now let’s save and run our python script.
Here is our desktop Notification. Simple, isn’t it? Hope this tutorial has helped.
Congratulations on creating your first desktop application.
You can play around with the library, explore more features and even customize it further.
Do share your valuable feedback and suggestions!
You should definitely check out my other Blogs:
Visualization of Coronavirus(COVID-19) Confirm Cases in India on Map
Coronavirus: The first case of the COVID-19 pandemic in India was reported on 30 January 2020, beginning from China…
All About Google Dorks
In this blog, you will get to know about google Dorking and some pro tips which I used to become the author of my own…
GitLab VS GitHub
Hi everyone !!! I hope you all are doing well. Today we will be discussing key differences between GitHub and GitLab…
See you in my next Blog article, Take care