I have written a Python 3 data processing application.
It has a front end that can be run from a Linux command line, or a GUI, using tkinter.
If a am on a headless console, or coming via SSH, a Windows manager is not available, so the GUI won’t work. What is the recommended way of detecting this, so I don’t try the GUI and just run the command line version?
The best I can come up with is:
try:
start_gui()
except:
start_commandline()
But think there must be a better way!
Ideally the solution would be platform independent!