push notification using python 1

push notification using python

toaster = ToastNotifier()
toaster.show_toast("Weather Information",
    f"{information}",
    duration=10,
    threaded=True)
    while toaster.notification_active(): time.sleep(0.005)

Here is what the above code is Doing:
1. We are importing the modules we need.
2. We are creating a variable called information and assigning it the value of the function get_weather_information.
3. We are creating a variable called toaster and assigning it the value of the ToastNotifier class.
4. We are calling the show_toast method on the toaster variable and passing it the following arguments:
a. The title of the toast notification.
b. The body of the toast notification.
c. The duration of the toast notification.
d. The threaded argument.
5. We are creating a while loop that will run as long as the toast notification is active.

Similar Posts