In this project, we are going to make a custom notification system to remind us to take a break. Like, sometimes we spend a lot of time sitting on Computers doing our work. If you sit on Computers for ling time, you may be risking your health. So, we are going to make a reminder notification system to get up from your seat and take a rest after 1 hour is completed sitting on your computer.
So, that's all about it!
We just need one python library to make the code... plyer
Plyer is a Python library for accessing features of your hardware / platforms. We would be using notification of plyer to show messages.
The code...
Now let me explain the code. So basically, when the program runs, we start an infinite loop. Inside the loop, we have used notify function of notification. The first line sets the title shown above the notifiaction. Then we have message, in which we enter the string we want to display as message. Then there is app_icon. So, we can add the path of an icon image inside it. Just make sure the icon is in '.ico' format.
So I think that's all about this project. If you want more like this, do let me know in the comments below... And Subscribe to this blog because I would be sharing more such projects of mine in future on this blog. Also, if you didn't see, check out my last project of a Music Player web app made in JavaScript. Click here
Then Bye Bye!
Thanks for reading... :)
See you!
Extra Reading:
A notification is about something (object = event, friendship..) being changed (verb = added, requested..) by someone (actor) and reported to the user (subject). Here is a normalized data structure (though I've used MongoDB). You need to notify certain users about changes. So it's per-user notifications.. meaning that if there were 100 users involved, you generate 100 notifications.
(Add time fields where you see fit)
This is basically for grouping changes per object, so that you could say "You have 3 friend requests". And grouping per actor is useful, so that you could say "User James Bond made changes in your bed". This also gives ability to translate and count notifications as you like.
But, since object is just an ID, you would need to get all extra info about object you want with separate calls, unless object actually changes and you want to show that history (so for example "user changed title of event to ...")
2 Comments
It's too easy man. You shouldn't keep this as a tutorial :(
ReplyDeleteIt can be useful in making big apps where we cam just copy and paste this piece of code to reduce our work.... Thanks MrDev
Delete