windows_toasts.toast_document

Classes

windows_toasts.toast_document.IXmlType

alias of IXmlNode | XmlElement

windows_toasts.toast_document.ToastDocument(toast)

The XmlDocument wrapper for toasts, which applies all the attributes configured in Toast

Data

windows_toasts.toast_document.IXmlType

alias of IXmlNode | XmlElement

API

class windows_toasts.toast_document.ToastDocument(toast: Toast)[source]

The XmlDocument wrapper for toasts, which applies all the attributes configured in Toast

xmlDocument: winrt.windows.data.xml.dom.XmlDocument
bindingNode: winrt.windows.data.xml.dom.IXmlNode | winrt.windows.data.xml.dom.XmlElement

Binding node, as to avoid having to find it every time

static GetAttributeValue(nodeAttribute: winrt.windows.data.xml.dom.IXmlNode | winrt.windows.data.xml.dom.XmlElement, attributeName: str) str[source]

Helper function that returns an attribute’s value

Parameters:
  • nodeAttribute (IXmlType) – Node that has the attribute

  • attributeName (str) – Name of the attribute, e.g. “duration”

Returns:

The value of the attribute

Return type:

str

GetElementByTagName(tagName: str) winrt.windows.data.xml.dom.IXmlNode | winrt.windows.data.xml.dom.XmlElement[source]

Helper function to get the first element by its tag name

Parameters:

tagName (str) – The name of the tag for the element

Return type:

IXmlType

SetAttribute(nodeAttribute: winrt.windows.data.xml.dom.IXmlNode | winrt.windows.data.xml.dom.XmlElement, attributeName: str, attributeValue: str) None[source]

Helper function to set an attribute to a node. <nodeAttribute attributeName=”attributeValue” />

Parameters:
  • nodeAttribute (IXmlType) – Node to apply attributes to

  • attributeName (str) – Name of the attribute, e.g. “duration”

  • attributeValue (str) – Value of the attribute, e.g. “long”

SetNodeStringValue(targetNode: winrt.windows.data.xml.dom.IXmlNode | winrt.windows.data.xml.dom.XmlElement, newValue: str) None[source]

Helper function to set the inner value of a node. <text>newValue</text>

Parameters:
  • targetNode (IXmlType) – Node to apply attributes to

  • newValue (str) – Inner text of the node, e.g. “Hello, World!”

SetAttributionText(attributionText: str) None[source]

Set attribution text for the toast. This is used if we’re using InteractableWindowsToaster but haven’t set up our own AUMID. AttributionText on Microsoft.com

Parameters:

attributionText – Attribution text to set

SetAudioAttributes(audioConfiguration: ToastAudio) None[source]

Apply audio attributes for the toast. If a loop is requested, the toast duration has to be set to long. Audio on Microsoft.com

SetTextField(nodePosition: int) None[source]

Set a simple text field. Text elements on Microsoft.com

Parameters:

nodePosition – Index of the text fields of the toast type for the text to be written in

SetTextFieldStatic(nodePosition: int, newValue: str) None[source]

SetTextField() but static, generally used for scheduled toasts

Parameters:
  • nodePosition – Index of the text fields of the toast type for the text to be written in

  • newValue – Content value of the text field

SetCustomTimestamp(customTimestamp: datetime) None[source]

Apply a custom timestamp to display on the toast and in the notification center. Custom timestamp on Microsoft.com

Parameters:

customTimestamp (datetime.datetime) – The target datetime

AddImage(displayImage: ToastDisplayImage) None[source]

Add an image to display. Inline image on Microsoft.com

SetScenario(scenario: ToastScenario) None[source]

Set whether the notification should be marked as important. Important Notifications on Microsoft.com

Parameters:

scenario (ToastScenario) – Scenario to mark the toast as

AddInput(toastInput: ToastInputTextBox | ToastInputSelectionBox) None[source]

Add a field for the user to input. Inputs with button bar on Microsoft.com

SetDuration(duration: ToastDuration) None[source]

Set the duration of the toast. If looping audio is enabled, it will automatically be set to long

AddAction(action: ToastButton | ToastSystemButton) None[source]

Adds a button to the toast. Only works on InteractableWindowsToaster

AddProgressBar() None[source]

Add a progress bar on your app notification to keep the user informed of the progress of operations. Progress bar on Microsoft.com

AddStaticProgressBar(progressBar: ToastProgressBar) None[source]

AddProgressBar() but static, generally used for scheduled toasts