windowstoast - Python Module for sending Toast Notifications on Windows 10
Installation
To install windowstoast
from PyPi run:
pip install windowstoast
Usage
Create a Toast Notification
from windowstoast import Toast
t = Toast(AppID, NotificationID, ActivationType='protocol', Duration='short', Launch='file:', Scenario='default', Popup=True)
t.show()
Add Text to the Toast Notification
t.add_text(text, maxlines=None, attribution=None)
Add Image to the Toast Notification
t.add_image(source, placement=None, hint-crop='circle')
Add Custom audio to the Toast Notification
t.add_audio(source="", silent=False)
Add Progress Bar to the Toast Notification
t.add_progress(status, title, value, value_label)
t.add_content_menu(content, arguments, activationType='protocol')
Add Button to the Toast Notification
t.add_button(content='Dismiss', argument='Dismiss', activationType='system')
Launch Custom Action on Button Click
import windowstoast
create_protocol(protocol_uri, comman_target)
remove_protocol('Protocol_name')
from sys import argv
a = argv[1:]
print(a)
t.add_button('My Button','My-Custom-Uri:My_Argument', 'protocol')
Update Your Notification
notificationID = '12345'
t = Toast('My Application ID', notificationID)
t.add_text('Title')
t.add_progress('Status...', 'Progress Title', '0', '0% Completed!')
t.show()
for i in range(10):
t = Toast('My Application ID', notificationID, Popup=False)
t.add_audio(silent=True)
t.add_text('Title')
t.add_progress('Status...', 'Progress Title', str(i/10), str(i)+'% Completed!')
t.show()