Open zFishStick opened 10 months ago
Use Base64 to decode image from code to file (temp), and next use it.
from win11toast import toast import base64 import os
icon_base64 = "your_base64_code_here"
icon_data = base64.b64decode(icon_base64)
temp_folder = os.environ['TEMP']
icon_path = os.path.join(temp_folder, 'icon.png')
with open(icon_path, 'wb') as icon_file: icon_file.write(icon_data)
icon_url = 'file://' + icon_path
icon = { 'src': icon_url, 'placement': 'appLogoOverride' }
try: toast('Hello', 'Hello from Python', icon=icon) except Exception as e: print("An error occurred while displaying the notification:", e)
I don't know why but when i create a toast with an absolute path icon it works, but when i use a relative or a URL it doesn't work. I tried with the example given by the dev: toast('Hello', 'Hello from Python', icon='https://unsplash.it/64?image=669'), but nothing, it prints the text but nor the image.