Reputation: 1
I'm in a pretty sticky situation... I've made an application on python, and then have SysTrayIcon to add a tray item for a user to easily show/hide/close the app.
Unfortunately, the quit method doesn't close my app at all, it just deletes the tray icon previously created...
What I'd like it to do is close the main application window and the tray icon at the same time.
For this effect, I've already tried calling os.system("TASKKILL /F /IM py.exe")
(the cmd window launched from the running application). This didn't work.
I tried the similar:
for process in (process for process in psutil.process_iter() if process.name()=="py.exe"):
process.kill()
to no avail.
I also tried sys.exit()
, but that just closes the Tray Icon system of course, not the cmd process.
I've sort of run out of ideas, so I'd greatly appreciate it if anyone has additional tips or ideas to fix this.
Feel free to ask if I've left out some info for good understanding of the issue.
Upvotes: 0
Views: 113