Script closed automatically

#202 · open · 1 comments

View on GitHub ↗

jaspqm3

When running the example code from [Interactable toasts](https://windows-toasts.readthedocs.io/en/latest/interactable.html#usage), the script is automatically closed, thus does not print the `response`. In my case, I'm trying to write a log based on the user's response, then only closes when the user is done (either logging or close the notification). But since the script is automatically closed, I can't write the log, let alone create the log file if it doesn't exist. ```python from windows_toasts import InteractableWindowsToaster, Toast, ToastActivatedEventArgs, ToastButton def activated_callback(activatedEventArgs: ToastActivatedEventArgs): user_argument = activatedEventArgs.arguments with open('log.txt', 'w') as log_file: log_file.write(user_argument) toaster = InteractableWindowsToaster('Task Reminder', 'Custom.AUMID') task_reminder = Toast(['Task finished?']) task_reminder.AddAction(ToastButton('Done', 'status=done')) task_reminder.AddAction(ToastButton('Not yet','status=unfinished')) toaster.show_toast(task_reminder) task_reminder.on_activated = activated_callback ```   OS: Windows 11 Python 3.13.3 Windows-Toasts 1.3.1

Comments

DatGuy1

You should bind on_activated before show_toast. Move the last line up and it should work.