Created
September 8, 2020 08:47
-
-
Save zooba/e21e204c9e79b0d6d76e7ddede501eb5 to your computer and use it in GitHub Desktop.
Popping up a toast notification using the winrt library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from winrt.windows.ui.notifications import ToastNotificationManager, ToastNotification, ToastTemplateType | |
def toast(title, text): | |
xml = ToastNotificationManager.get_template_content(ToastTemplateType.TOAST_TEXT02) | |
ee = xml.get_elements_by_tag_name("text") | |
ee[0].append_child(xml.create_text_node(title)) | |
ee[1].append_child(xml.create_text_node(text)) | |
notifier = ToastNotificationManager.create_toast_notifier() | |
notifier.show(ToastNotification(xml)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment