GitHub30 / win11toast

Toast notifications for Windows 10 and 11 based on WinRT
https://pypi.org/project/win11toast/
MIT License
227 stars 15 forks source link

Toast for buttons #9

Closed Insomnia00 closed 1 year ago

Insomnia00 commented 1 year ago

For toast buttons apparently there's no way to know which button was clicked, I can input arguments and derived from there or is there other way?

GitHub30 commented 1 year ago

You can handle the input with on_click.

from win11toast import toast

toast('gain value', 'please chose', buttons=['A', 'B', 'C'], on_click=lambda args: print('clicked!', args))
# clicked! {'arguments': 'http:B', 'user_input': {}} on B clicked

https://github.com/GitHub30/win11toast/discussions/3

Insomnia00 commented 1 year ago

yeap i have a similar solution (just wondering if theres any other func), this can also added to your readme.md , its a pretty good function