winotify
winotify copied to clipboard
Can't trigger a function for Button Click!
Describe the bug I really can 't invoke the function when the button is called in Notifier notification
To Reproduce Steps to reproduce the behavior:
import winotify
r = winotify.Registry("test2", winotify.PY_EXE, __file__)
notifier = winotify.Notifier(r)
@notifier.register_callback
def callback():
with open("gg.txt", 'w') as f:
f.write("Ggg")
if __name__ == '__main__':
toast = winotify.Notification(app_id="Boot Logger",
title="Shutdown Log",
msg="Unable to Log Shutdown Time: Network Error!\n\nDo you want to Overwrite?",
duration="short")
toast.set_audio(winotify.audio.Reminder, loop=False)
toast.add_actions(label="Overwrite", launch=callback)
toast.show()
Just execute this code!
Expected behavior It should write that file!
Desktop (please complete the following information):
- Windows 10 Version 10.0.19044
- Windows Powershell Version 5.1.19041.2673
Maybe this helps: https://github.com/versa-syahptr/winotify/blob/master/test/callback_example.py