I've created an executable file of my GUI python script using Pyinstaller (I used tkinter as the framework, and Anaconda3, Python 3.7 and I am on Windows 10). I have set it up to start automatically upon Windows startup, using Task Scheduler.
I have been asked to make it run in the system tray, silently, but not as a service (because sometimes it requires user interaction).
Thanks to the incredibly helpful users from here:
What's the simplest way to put a python script into the system tray (Windows)
Minimise Python to System Tray and Generate Notifications?
How to build a SystemTray app for Windows?
I have the win32py script that creates the system tray icon with some menu and simple functions. However, I can not figure out the very obvious thing of how to link my tkinter GUI script with this code.. I tried to execute my script using execfile().open() and make it run like a normal menu_action within the script, but it doesn't work.
Some discussions here:
Hide tkinter window in system tray
show that it is not possible to hide tkinter frames in the system tray. But as far as I understand, the script from above is independent on this.
I found out about this tcl extension tktray (https://core.tcl-lang.org/jenglish/gutter/packages/tktray.html) and I am now learning how to build it into tlc., which isn't as trivial as I thought. However, tktray is 10 years old so I don't have much hopes it will be compatible with current versions.
All other solutions I found were for other programming languages, other OS or using PyQ5. I would hate to rewrite my entire code with wxPython or PyQ5 just for this extra feature, so if anyone can help me out with linking my GUI script with the win32py script from above...