J-CITY / tinyWinToast

Tiny library to show windows toast
MIT License
25 stars 4 forks source link

Duplicate buttons when toast spawned in a function #8

Open liu2g opened 1 year ago

liu2g commented 1 year ago

Hello, I recently discovered this package and it works like a charm! Not sure if this is still actively maintained, but I discovered a bug where multiple copies of the button are created when I tried to dynamically create a toast in a function multiple times, for example

    import time
    def foo():
        toast = Toast()
        toast.setTitle("TITLE", maxLines=2)
        toast.setMessage("MESSAGE", maxLines=2)
        toast.addButton(
            Button(content="Button", activationType=ACTION_TYPE_BACKGROUND,
                   arguments="", pendingUpdate=False))
        toast.show()
    for _ in range(3):
        foo()
        time.sleep(1)

This creates three toast no problem, but the second time it spawns with two buttons, and the third time three buttons.

image

Let me know if there is future plan of looking into this, thank you!