Hello programmers, today we are going to try something new. Today I am going to demonstrate how to show Toast Notification or System notification like notification message using python.
For this we need to install new library named “plyer.” you can install this package using pip command just like shown below
pip3 install plyer
It will take few seconds to install this library. after that just type code as given below or you can just copy and paste this code in your terminal or there is download option available to directly download the notifiy.py file just click on download button
from plyer import notification notification.notify( title='Here is the title', message='Here is the message', app_icon=None, #ex:path_to_file/warning.ico timeout=5, #in seconds )
After executing this program output will be like shown below.
Here title is what title you want to give to Notification. After this message is what message is going to shown. After that app_icon is what sign you want to show like error message or warning message. Her e you can provide path to image insted of None. Lastly timeout is used to show notification upto particular time. Here we are going to show Notification for 5 seconds.
That’s it. execute the code to check its working or not on your system. you can modify title or message or even timeout to show notification message.
If you face any problem regarding this program just comment below to let us know. We will try to solve your problem for this code
Thank you...Happy Coding :) :)