title: how to fix No display name and $DISPLAY environment variable python error
body: <p>I am trying to make a game about clicking a button to get sap(long story), you click a tkinter button, but when i tried to add it to flask but it kept saying "</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/4TRS/mysite/SAPGAME.py", line 2, in &lt;module&gt;
      window = tkinter.Tk()
    File "/usr/lib/python3.7/tkinter/__init__.py", line 2020, in __init__
      self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
  _tkinter.TclError: no display name and no $DISPLAY environment variable"
  </code></pre>
  
  <p>This is my code</p>
  
  <pre><code>import tkinter
  window = tkinter.Tk()
  button=tkinter.Button(window, text="Click to get sap", width=40)
  button.pack(padx=10, pady=10)
  clickcount = 0
  def onclick(event):
      global clickcount
      clickcount = clickcount + 1
      sap1 = clickcount
      sap = str(sap1)
      if clickcount &gt;= 1:
          button.configure(text="You have " + sap + " saps")
  button.bind("&lt;ButtonRelease-1&gt;", onclick)
  window.mainloop()
  </code></pre>
  
  <p>I want to be able to simply click the button. when I do it in IDLE it works just fine but when i try it on any online IDE it has the same error. I have been at this for hours and can't find a solution.</p>