title: In Python/tkinter, what is the best way to detect if you are using SSH, so Windows are not available?
body: <p>I have written a Python 3 data processing application.<br>
  It has a front end that can be run from a Linux command line, or a GUI, using tkinter.</p>
  
  <p>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?</p>
  
  <p>The best I can come up with is:</p>
  
  <pre><code>try:
     start_gui()
  except:
     start_commandline()
  </code></pre>
  
  <p>But think there must be a better way!</p>
  
  <p>Ideally the solution would be platform independent!</p>