def hide_toast(self, toast: Toast) -> None:
"""
Removes the specified toast notification from the screen
:raises: ToastNotFoundError: If the toast could not be found
"""
toastHistory: ToastNotificationHistory = ToastNotificationManager.history
targetNotification: Optional[ToastNotification] = next(
(poppedToast for poppedToast in toastHistory.get_history(self._AUMID) if poppedToast.tag == toast.tag), None
)
if targetNotification is None:
raise ToastNotFoundError(f"Failed to hide toast. Toast {toast} not found")
self.toastNotifier.hide(targetNotification)
But .hide() raises the following exception: OSError: [WinError -2143420152] The notification cannot be hidden until it has been shown
This, on paper, should work:
But .hide() raises the following exception:
OSError: [WinError -2143420152] The notification cannot be hidden until it has been shown