如何解决如何从python winrt toast获取按钮和文本输入?
如何在按下按钮时获取调用函数的代码,并从 pywinrt toast 的文本框中获取输入?
我正在制作一个 Python 库,可以让 Windows 吐司通知更容易在 Python 中制作。
代码:
import winrt.windows.ui.notifications as notifications
import winrt.windows.ui.notifications.management as listener
import winrt.windows.data.xml.dom as dom
#create notifier
nManager = notifications.ToastNotificationManager
notifier = nManager.create_toast_notifier(r"C:\Users\Admin\AppData\Local\Programs\Python\Python38\python.exe")
#define your notification as
tString = """
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Hi!</text>
<text>I am a toast.</text>
</binding>
</visual>
<actions>
<input id="textBox" type="text" placeHolderContent="Type a reply"/>
<action
content="send message"
arguments="action=reply&convId=01"
activationType="background"
hint-inputId="textBox"/>
<action
content="OK"
arguments="action=viewdetails&contentId=02"
activationType="foreground"/>
</actions>
</toast>
"""
#convert notification to an XmlDocument
xDoc = dom.XmlDocument()
xDoc.load_xml(tString)
#display notification
notifier.show(notifications.ToastNotification(xDoc))
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。