icon_path 在 python 的 win10toast 模块中不起作用 [英] icon_path isn't working in win10toast module in python
本文介绍了icon_path 在 python 的 win10toast 模块中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 win10toast、time 和 playsound 在 python 3.7 中设置倒计时时钟.代码如下:
I'm attempting a countdown clock in python 3.7 using win10toast, time and playsound. Here's the code:
import time
import playsound
import win10toast
Toaster = win10toast.ToastNotifier()
def countdown(y):
while y > 0:
print(y)
y -= 1
time.sleep(1)
playsound.playsound('alarm-clock-ringing.mp3')
Toaster.show_toast('Countdown notifier', 'countdown over', duration=9,
icon_path=r'D:\img.ico')
try:
x = int(input('how many seconds do you want to countdown?: '))
countdown(x)
except ValueError:
print('That wasn\'t an integer! Please enter an integer!')
它工作正常,除了第 14 行中的 icon_path.我得到的错误是:
It works fine, except for icon_path in line 14. The error I'm getting is:
ERROR:root:Some Problem with the icon (D:\img.ico): (0, 'LoadImage', 'No error message is available')
ERROR:root:Some trouble with the icon (D:\img.ico): (0, 'LoadImage', 'No error message is available')
顺便说一下,我使用的是 64 位 Windows 10 专业版.
By the way, I'm using windows 10 pro 64-bit.
谢谢!
推荐答案
你好!
import time
from win10toast import ToastNotifier
toaster = ToastNotifier()
toaster.show_toast("Hello World!!!","Python is 10 seconds awsm!",icon_path=
filename.ico,duration=10,threaded=False)
while toaster.notification_active():
time.sleep(0.1)
复制和粘贴,欢迎您:)
这篇关于icon_path 在 python 的 win10toast 模块中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文