Icon_path Isn't Working In Win10toast Module In Python
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.ToastNoti
Solution 1:
Hello!
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)
Copy and Paste,Your Welcome :)
Solution 2:
First, convert the .jpg
or .png
file that u have into a .ico
file. U can do it using python's PIL
library like this:
from PIL import Image
filename = "logo.png"
img = Image.open(filename)
img.save('logo.ico')
Now, u have saved the logo as an ico
file, so u can easily use it in ur code like this:
from win10toast importToastNotifiertoast= ToastNotifier()
file_name = 'logo.ico'
toast.show_toast("Notification","Notification Body", duration=5, icon_path = file_name)
Hope that this helps!
Solution 3:
According to the documentation, LOAD-ICON should pick up the 32x32 version of the icon (if it exists)
- LOAD-IMAGE does not work if .ICO file contains a 256x256 icon.
- Using an ICO file with 32x32, 16x16, and/or 48x48 icons works.
- Icon files with several images work unless it contains a 256x256 version. In this case, no icon is loaded.
Solution 4:
just replace this:
'D:\img.ico' ==> 'D:/img.ico'
or use it in this way:
'D:\\img.ico'
Post a Comment for "Icon_path Isn't Working In Win10toast Module In Python"