title: End a loop in a function from another function in python
body: <p>Is is possible in python to end a loop in a function from another function? 
  This does not seem to work</p>
  
  <p>Here is my code:</p>
  
  <pre><code>from tkinter import*
  root = Tk()
  def loop():
      global superman
      superman=False
      while superman==False:
          print("It's doing something")
  def endloop():
      global superman
      superman=True
  
  btn_1 = Button(root, text="stop", command=endloop)
  btn_1.pack()
  btn_2 = Button(root, text="start", command=loop)
  btn_2.pack()
  </code></pre>