python - python winrt windows Toast通知获取输入作为变量
问题描述
import winrt.windows.ui.notifications as notifications
import winrt.windows.data.xml.dom as dom
#create notifier
nManager = notifications.ToastNotificationManager
notifier = nManager.create_toast_notifier(r"C:\Users\andyy\AppData\Local\Programs\Python\Python37\python.exe")
#define your notification as
tString = """
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Sample toast</text>
<text>Sample content</text>
<text>asdfasdadsfds</text>
</binding>
</visual>
<actions>
<input id="textBox" type="text" placeHolderContent="Type a reply"/>
<action
content="Send"
arguments="action=reply&convId=9318"
activationType="background"
hint-inputId="textBox"/>
</actions>
</toast>
"""
#convert notification to an XmlDocument
xDoc = dom.XmlDocument()
xDoc.load_xml(tString)
#display notification
notifier.show(notifications.ToastNotification(xDoc))
这是我尝试创建带有输入的 toast 通知,并且它有效。但我想获取用户输入输入的字符串。我该怎么做?
解决方案
我想你需要在这里注册后台访问
按钮使您的 toast 具有交互性,让用户可以对您的 toast 通知采取快速操作,而不会中断他们当前的工作流程。例如,用户可以直接从 toast 中回复消息,或者删除电子邮件,甚至无需打开电子邮件应用程序。按钮出现在通知的展开部分。
我正在尝试注册但失败了。让我知道它是否有效
推荐阅读
- python - 理解 Python 中的 for 循环
- php - 如何使用 updateOrCreate 函数将数据从一个 json 文件插入到 laravel 中具有相关数据的多个表中?
- scala - 从资源目录读取文件的scala问题
- sql - 从包含来自单独列的数据的列中选择数据
- dialogflow-es - 如何在 DialogFlow 中动态更改意图顺序
- python - 构建 Python 3.7.1 - SSL 模块失败
- java - 不允许超过最大和相同注册数量的参与者的方法
- c++ - 为内联函数定义了多次,怎么可能?
- r - 在R中,如何按值符号分组?
- html - CSS中的平滑滚动