python - 当我使用 toastnotification 执行 python exe 时,显示

当我执行带有 toastnotification 的 python exe 时,显示未找到 win10toast 分发

from win10toast import ToastNotifier
toaster = ToastNotifier()
toaster.show_toast("Hello World!!!",
              "Python is 10 seconds awsm!",
              icon_path="custom.ico",
              duration=10)
toaster.show_toast("Hello World!!!",
             "Python is awesome by default!")

Screenshot

最佳答案

我通过切换到 plyer 库解决了这个问题。最初,它有一个类似的问题,但添加特定于平台的导入有帮助:

import plyer.platforms.win.notification
from plyer import notification

notification.notify("Title", "Body")

引用: https://github.com/kivy/plyer/issues/485

关于python - 当我使用 toastnotification 执行 python exe 时,显示未找到 win10toast 分发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50758709/

相关文章:

c# - 从 JSON 中提取第一个元素

python - 属性错误 : 'str' object has no attribute 'Sub

python - importlib.reload() 没有将文件重新加载到 ipython 笔记本

image-processing - 如何使用网格分割图像并保留透明边界框

react-native - 如何在 createBottomTabNavigator 中获取背景图

scala - 我如何处理下面udf中的空指针异常错误

apache-spark - Apache Spark 2.0 (PySpark) - DataFr

php - 在 google drive api 的根目录中创建文件夹并将文件上传到该文件夹

android-studio - 无法解析 : com. google.android.gms :p

r - 安装旧包 R