jithurjacob / Windows-10-Toast-Notifications

Python library to display Windows 10 Toast Notifications
MIT License
970 stars 168 forks source link

Tkinter App freezes #47

Open abzlrz opened 5 years ago

abzlrz commented 5 years ago

The app GUI always freezes after running a method with toast notif in it... idk but you may give yourself a try... this method is a member of a tkinter toplevel class which i invoke when user clicks a button

def mymethod(self):
        hs = generate_hash()
        newpath = f'..\\results\\results{hs}\\'

        os.makedirs(newpath)
        X = readall_images(self.inputvar.get())
        saveall_images(X, newpath, "")

        opennotif(newpath, "Done", "open it!")

        self.inputvar.set("")
        X = None

on the top on it, I import a function I made dedicated for toast notification... the function looks like this:

def opennotif(dir, header, msg):
    tst = ToastNotifier()
    res = tst.show_toast(str(header), str(msg))

    if res is True:
        os.system(f'explorer "{dir}"')
elibroftw commented 5 years ago

use the threaded option tst.show_toast(str(header), str(msg), threaded=True)