2024-05-20 00:54:50 发布
网友
有没有办法在Windows10中使用python创建交互式toast通知? 目前我正在使用plyer,有时我使用win10toast。 当有人单击它时,我希望它在web浏览器中打开一个页面,并包含图像、图标、文本和用户输入
plyer
win10toast
对于图像部分,可以使用如下模块winrt:
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> <image placement="appLogoOverride" hint-crop="circle" src="https://picsum.photos/48?image=883"/> </binding> </visual> </toast> """ xDoc = dom.XmlDocument() xDoc.load_xml(tString) notification = notifications.ToastNotification(xDoc) #display notification notifier.show(notification)
另外,有三个地方可以放置图像:AppLogoOverride、Inline和Hero
我翻遍了win10toast的source code,发现他们使用this library创建windows gui元素,here是最新的版本。在那里,您应该能够找到正确的模块来使用
对于图像部分,可以使用如下模块winrt:
另外,有三个地方可以放置图像:AppLogoOverride、Inline和Hero
我翻遍了win10toast的source code,发现他们使用this library创建windows gui元素,here是最新的版本。在那里,您应该能够找到正确的模块来使用
相关问题 更多 >
编程相关推荐