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通知的一次尝试,它是有效的。但是我想得到用户输入的字符串。我该怎么做
我想你需要注册背景访问here
我正在尝试注册,但失败了。让我知道它是否有效
相关问题 更多 >
编程相关推荐