GitHub30 / win11toast

Toast notifications for Windows 10 and 11 based on WinRT
https://pypi.org/project/win11toast/
MIT License
234 stars 15 forks source link

Doesnt work as documentation explains #27

Closed dmtzs closed 8 months ago

dmtzs commented 11 months ago

I have the next script:

from win11toast import toast

toast(title="Some title", body="Some body", icon="bell.ico", duration="short")

I dont get any error but just stat in a loop without doing nothing

Thank you in advance

MadobyPy commented 11 months ago

I think the issue lies with the icon's path, try adding the full path of your icon instead of the relative path:

Example:

icon_path = r"D:\PythonApp\App-1-name\Assets\bell.ico"
toast(title="Some title", body="Some body", icon=icon_path, duration="short")

#or

toast(title="Some title", body="Some body", icon=r"D:\PythonApp\App-1-name\Assets\bell.ico", duration="short")

don't forget to add (r) before the string, it indicates that the \ (backslashes) should be treated as literal characters and not as escape characters

Alternatively: you can use double slashes in your path without (r), as follows:

icon_path = "D:\\PythonApps\\App-1-name\\Assets\\bell.ico"

toast(title="Some title", body="Some body", icon=icon_path, duration="short")

I hope adding the full path solves the issue for you it worked for me

Good luck

dmtzs commented 10 months ago

Will try, I will be back if this works just to let you know. Thank you

dmtzs commented 8 months ago

It works in that way, I think then the only problem is to enhance the errors cause if you run the original script I posted in this issue then you don't see any traceback until you press Ctrl + c, the code should exit by himself if its the case, but well. Also thank you @MadobyPy , that solves the issue i had.