Open GIskierka opened 6 years ago
I don't understand why it doens't work only with us, @GIskierka. I tried in my friend's computer, in virtualenv and nothing.
After more than one year, this issue still not fixed and victims still need to dig solutions out...
The problem could be the icon_path
parameter hasn't been set
You can try my solution here:
from pathlib import Path
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path("./assets")
def relative_to_assets(path: str) -> Path:
return ASSETS_PATH / Path(path)
toaster = ToastNotifier()
toaster.show_toast("Title", "Message", icon_path=relative_to_assets('../assets/icon.ico'), duration =5)
(My icon file is saved in './assets' folder, your project structure could be different from me)
Note: the path that you pass to relative_to_assets
function must be the relative path to your *.ico
file
Good luck =)))
import time
from win10toast import ToastNotifier
if __name__ == '__main__':
while True:
toaster = ToastNotifier()
toaster.show_toast("Hello World!!!", "Python is 10 seconds awsm!", duration=10, icon_path='')
time.sleep(2)
This is my code, I have kept path of my icon to ''(blank)
but still its isn't still working, I have used AUTO_PY_TO_EXE to convert it to .exe file it just opens and its closed!
I have installed Python 3.10.4 from Windows Store and I have also have Python 3.8.8
my project works well when I open it with 3.10.4 Python but it doesn't work well when opened with 3.8.8 or 3.9.7 too!
When trying to run this with Python(3.9.7 I guess) it is not working
I write my code in Pycharm and import all the libraries from the built-in pip module. I've done the same with win10toast, and as long as I launch the code from Pycharm it works great, but after converting the project into an executable file the notifications are not shown at all.
Here's the code:
import win10toast
toaster = win10toast.ToastNotifier()
toaster.show_toast("Test", "Hello", duration=5, threaded=True)
I was just testing the library's capabilities so it's just a simple code. I've tried converting it to exe with pyinstaller from windows 10 cmd, as well as py2exe.net
Please let me know if it's just a problem that occurrs on my machine or is it to do with the way the library is written or maybe even with the conversion to exe itself. Thank you in advance.