winotify icon indicating copy to clipboard operation
winotify copied to clipboard

Can't trigger a function for Button Click!

Open Sayad-Uddin-Tahsin opened this issue 2 years ago • 1 comments

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

Sayad-Uddin-Tahsin avatar Apr 30 '23 07:04 Sayad-Uddin-Tahsin

Maybe this helps: https://github.com/versa-syahptr/winotify/blob/master/test/callback_example.py

D4koon avatar Nov 28 '24 21:11 D4koon