Windows-10-Toast-Notifications: Error in Python 3.11
A somewhat arcane error message after showing a toast in Python 3.11:
from win10toast import ToastNotifier
t = ToastNotifier()
>>> t.show_toast("hello")
WNDPROC return value cannot be converted to LRESULT
TypeError: WPARAM is simple, so must be an int object (got NoneType)
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 16
Commits related to this issue
- WM_DESTROY callback must return 0 fixes #112 — committed to f3ndot/Windows-10-Toast-Notifications by f3ndot a year ago
Hi there, I found a wonderful module to solve this problem. Use the following command to install it:
pip install win11toastIt seems to be OK to use
win11toastinstead ofwin10toast.For more information, go to https://pypi.org/project/win11toast/ .
You can also view it on GitHub: https://github.com/GitHub30/win11toast
Or you can also handle the
TypeErrorofwin10toastwith atry-exceptblock.(I’m sorry but I’m a 16-year-old student from a secondary school in China. There may be some grammatical errors in my reply.)
Hope this can help you all.
to fix the issue, simple go to the init.py file of win10toast in you virtual environment, and adjust the return value of the “on_destroy” function, replace it with this ’ def on_destroy(self, hwnd, msg, wparam, lparam): “”"Clean after notification ended.
and you’re good. I’ll fork the project and make the changes then i’ll link it in a future edit.
to fix the issue, simple got to the init.py file of win10toast in you virtual environment, and adjust the return value of the “on_destroy” function, replace it with this ’ def on_destroy(self, hwnd, msg, wparam, lparam): “”"Clean after notification ended.
and you’re good. I’ll fork the project and make the changes then i’ll link it in a future edit.
I’m also getting the same error.
It doesn’t seem to break anything. It shows up for me after the duration ends, and the toast goes away.
https://i.imgur.com/qMZ1dvu.png