python中使用pywinrt的描述符有问题

python中使用pywinrt的描述符有问题,python,windows-10,windows-runtime,toast,descriptor,Python,Windows 10,Windows Runtime,Toast,Descriptor,我正在pywinrt中开发一个toast通知库,它将使python toast通知更容易 我正在测试用户输入部分,但无法使其工作 我发现我们可以从以下位置获取用户输入: winrt.windows.ui.notifications.ToastNotificationActionTriggerDetail.user\u input 但它给出了一个错误 Traceback (most recent call last): File "f:/coding/python/windowsGo

我正在pywinrt中开发一个toast通知库,它将使python toast通知更容易

我正在测试用户输入部分,但无法使其工作

我发现我们可以从以下位置获取用户输入:

winrt.windows.ui.notifications.ToastNotificationActionTriggerDetail.user\u input

但它给出了一个错误

Traceback (most recent call last):
  File "f:/coding/python/windowsGoodies/Notifications/test.py", line 49, in <module>
    print(press.currentButton())
  File "f:/coding/python/windowsGoodies/Notifications/test.py", line 43, in __get__
    notifications.ToastNotificationActionTriggerDetail.user_input.__get__(instance,owner)
TypeError: descriptor 'user_input' for '_winrt_Windows_UI_Notifications.ToastNotificationActionTriggerDetail' objects doesn't apply to a 'pressed' object
回溯(最近一次呼叫最后一次):
文件“f:/coding/python/windowsGoodies/Notifications/test.py”,第49行,在
打印(按.currentButton())
文件“f:/coding/python/windowsGoodies/Notifications/test.py”,第43行,在__
notifications.ToastNotificationActionTriggerDetail.user\u input.\u\u get\u(实例,所有者)
TypeError:用于“\u winrt\u Windows\u UI\u通知”的描述符“用户输入”。ToastNotificationActionTriggerDetail”对象不适用于“按下的”对象
我的代码

import winrt.windows.ui.notifications as notifications
import winrt.windows.data.xml.dom as dom

nManager = notifications.ToastNotificationManager
notifier = nManager.create_toast_notifier(r"C:\Users\Admin\AppData\Local\Programs\Python\Python38\python.exe")

tString = """
<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Another Message from Tim!</text>
            <text>Hi there!</text>
        </binding>
    </visual>

    <actions>
        <input id="textBox" type="text" placeHolderContent="Type a reply"/>
        <action
            content="Send"
            arguments="action=reply&amp;convId=01"
            activationType="background"
            hint-inputId="textBox"/>
    </actions>
</toast>
"""

xDoc = dom.XmlDocument()
xDoc.load_xml(tString)

notification = notifications.ToastNotification(xDoc)

#display notification
notifier.show(notification)
class getButtonPressed(object):
    def __get__(self,instance,owner):
        notifications.ToastNotificationActionTriggerDetail.user_input.__get__(instance,owner)

class pressed():
    currentButton = getButtonPressed()

press = pressed()
print(press.currentButton())
将winrt.windows.ui.notifications导入为通知
将winrt.windows.data.xml.dom导入为dom
nManager=notifications.ToastNotificationManager
notifier=nManager.create_toast_notifier(r“C:\Users\Admin\AppData\Local\Programs\Python\Python 38\Python.exe”)
tString=”“”
蒂姆又发了一条短信!
你好!
"""
xDoc=dom.XmlDocument()
加载xml(tString)
通知=通知。ToastNotification(xDoc)
#显示通知
notifier.show(通知)
类getButtonPressed(对象):
定义获取(自身、实例、所有者):
notifications.ToastNotificationActionTriggerDetail.user\u input.\u\u get\u(实例,所有者)
类已按下():
currentButton=getButtonPressed()
按=按()
打印(按.currentButton())
谢谢