Closed emcek closed 1 year ago
solution is replace order of:
root.protocol('WM_DELETE_WINDOW', partial(withdraw_window, root))
icon.run_detached()
and change destroy()
to quit()
def quit_window(window: tk.Tk, icon: Icon, *args, **kwargs):
print('quit', args, kwargs)
icon.visible = False
icon.stop()
window.quit()
Now quit_window()
will close app properly.
I have similar short example as some other people. The problem is even I quit application (from system tray icon), root windows is destroy, but icon thread is still running (probably), so whole process hang. I need kill it manually. Do I miss something?
I use
partial()
, because GUI is crated in different part of my application and I can not use global state fortk.Tk()
I was thinking, may it is possible to add
Event
(fromthreading
package) to get control overIcon
thread. Then you canevent.set()
from outside and thread will be terminated.