We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如图所示, 点击了 1 2 3 4 过后 handle_activated 返回结果都是一样的
def testToast(): # Step1. Create Notifier with applicationId notifier = Notifier('MQTT 消息通知') # Step2. Create Toast which contains the message to be shown toast = Toast() toast.add_text('第一行 1st line', hint_align='center', hint_style='caption') toast.add_text('第二行 2nd line') toast.add_text('第三行 3rd line', placement='attribution') # toast.add_image(path_pic, placement='appLogoOverride') # toast.add_input(type_='selection', id_='input_name') toast.add_action('1', hint_inputId='1') toast.add_action('2') toast.add_action('3') toast.add_action('4') toast.set_audio(silent='true') # Mute # Step3. Show the Toast notifier.show(toast, handle_activated=notifyActiveHandler, handle_dismissed=handle_dismissed) def notifyActiveHandler(event_args_activated: EventArgsActivated): print('activated') print('inputs:', event_args_activated.inputs) event_args_activated.sender print('argument:', event_args_activated.argument) def handle_dismissed(event_args_dismissed: EventArgsDismissed): print('dismissed') print('reason:', event_args_dismissed.reason)
The text was updated successfully, but these errors were encountered:
按钮(action)有activationType这个参数,但是文档(尤其是对于非安装程序的)太少了,所以我暂时只将按钮用于关闭。
activationType
你的这个需求可以用选项菜单代替一下:
from winsdk_toast import Notifier, Toast from winsdk_toast.event import EventArgsActivated, EventArgsDismissed, EventArgsFailed def testToast(): # Step1. Create Notifier with applicationId notifier = Notifier('MQTT 消息通知') # Step2. Create Toast which contains the message to be shown toast = Toast() toast.add_text('第一行 1st line', hint_align='center', hint_style='caption') toast.add_input('selection', id_='input01') toast.add_selection(content='1', id_='selection_1') toast.add_selection(content='2', id_='selection_2') toast.add_selection(content='3', id_='selection_3') toast.add_selection(content='4', id_='selection_4') toast.add_action('确认') # Step3. Show the Toast notifier.show(toast, handle_activated=notifyActiveHandler, handle_dismissed=handle_dismissed) def notifyActiveHandler(event_args_activated: EventArgsActivated): print('activated') print('inputs:', event_args_activated.inputs) print('argument:', event_args_activated.argument) def handle_dismissed(event_args_dismissed: EventArgsDismissed): print('dismissed') print('reason:', event_args_dismissed.reason)
Sorry, something went wrong.
No branches or pull requests
如图所示, 点击了 1 2 3 4 过后 handle_activated 返回结果都是一样的
The text was updated successfully, but these errors were encountered: