Closed danilobatistaqueiroz closed 2 years ago
What happens if you run with icon.run_detached()
?
Thank you for your report.
I have tested your sample application, and it appears to work as you expect it to. I am, however, using the AppIndicator backend.
The most troublesome part of your code, I think, is the call to icon.run()
in withdraw_window
; this method will block until the icon is destroyed, and UI-toolkits such as TKinter usually do not like it when you block the main method.
run_detached
, as suggested above, probably will not work either, as it requires that the framework you are integrating with uses the same kind of mainloop as this library, and I presume TKinter uses an X mainloop, whereas the usable backends for this library use GTK.
If you do not target macOS, my suggestion would be to run the icon in a separate thread, and let show_window
and withdraw_window
manipulate the visibility of the icon instead.
If I close the window and show it using the menu, everything works fine. But if I close again and try to show it than, it won't work. The event isn't even fired. I'm using Ubuntu with Cinnamon.
I noticed that the icon and menu are recreated.
I adapted a version using icon and menu globals, to avoid recreating, but it didn't work. It seems a problem in _base.py in stop() method, where
self._running = False
It seems that stop() method doesn't kill the thread for icon in linux.