How can I get the code to call a function when a button is pressed, and get input from a textbox from a pywinrt toast?
I am making a python library that can make windows toast notifications easier to make in python.
The Code:
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))
Thanks!