Toast notifications for Windows 10 and 11
Project description
win11toast
Toast notifications for Windows 10 and 11 based on WinRT
Installation
pip install win11toast
Usage
from win11toast import toast
toast('Hello Python🐍')
from win11toast import toast
toast('Hello Python', 'Click to open url', on_click='https://www.python.org')
Use callback
from win11toast import toast
toast('Hello Python', 'Click to open url', on_click=lambda args: print('clicked!', args))
# clicked! {'arguments': 'http:', 'user_input': {}}
Logo
from win11toast import toast
toast('Hello', 'Hello from Python', logo='https://unsplash.it/64?image=669')
Image
from win11toast import toast
toast('Hello', 'Hello from Python', image='https://4.bp.blogspot.com/-u-uyq3FEqeY/UkJLl773BHI/AAAAAAAAYPQ/7bY05EeF1oI/s800/cooking_toaster.png')
Audio
from win11toast import toast
toast('Hello', 'Hello from Python', audio='ms-winsoundevent:Notification.Looping.Alarm')
Available audio https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-audio
Button
from win11toast import toast
toast('Hello', 'Hello from Python', actions=['Dismiss'])
# {'arguments': 'dismiss', 'user_input': {}}
from win11toast import toast
toast('Hello', 'Click a button', actions=['Approve', 'Dismiss', 'Other'])
Input
from win11toast import toast
toast('Hello', 'Type anything', inputs=['textbox'], actions=['Send'])
# {'arguments': 'dismiss', 'user_input': {'textbox': 'Hi there'}}
Selection
from win11toast import toast
toast('Hello', 'Which do you like?', selections=['Apple', 'Banana', 'Grape'], actions=['Submit'])
# {'arguments': 'dismiss', 'user_input': {'selection': 'Grape'}}
No arguments
from win11toast import toast
toast()
Wrap text
from win11toast import toast
toast('Hello', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum accusantium porro numquam aspernatur voluptates cum, odio in, animi nihil cupiditate molestias laborum. Consequatur exercitationem modi vitae. In voluptates quia obcaecati!')
Jupyter
from win11toast import toast_async
await toast_async('Hello Python', 'Click to open url', on_click='https://www.python.org')
Debug
from win11toast import toast
xml = """
<toast launch="action=openThread&threadId=92187">
<visual>
<binding template="ToastGeneric">
<text hint-maxLines="1">Jill Bender</text>
<text>Check out where we camped last weekend! It was incredible, wish you could have come on the backpacking trip!</text>
<image placement="appLogoOverride" hint-crop="circle" src="https://unsplash.it/64?image=1027"/>
<image placement="hero" src="https://unsplash.it/360/180?image=1043"/>
</binding>
</visual>
<actions>
<input id="textBox" type="text" placeHolderContent="reply"/>
<action
content="Send"
imageUri="Assets/Icons/send.png"
hint-inputId="textBox"
activationType="background"
arguments="action=reply&threadId=92187"/>
</actions>
</toast>"""
toast(xml=xml)
Acknowledgements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
win11toast-0.12.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for win11toast-0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29d4013d33f8c46cce1ad4f32dce2e30ba01835fdcffdd3bb1ed35c6b0aea79b |
|
MD5 | 3351523964ba70dcaca6ca9784d6bfa8 |
|
BLAKE2b-256 | edab1bae0eafa9279b222ba385072a6a0637d44a8355efd82953b7eb0f7d3201 |