title: How do you create a Tkinter GUI stop button to break an infinite loop?
body: <p>So I have a Tkinter GUI with two simple options, a start and stop button. I have defined the GUI layout:</p>
  
  <pre><code>from Tkinter import *
  
  def scanning():
      while True:
          print "hello"
  
  root = Tk()
  root.title("Title")
  root.geometry("500x500")
  
  app = Frame(root)
  app.grid()
  </code></pre>
  
  <p>Here the Start button runs the infinite loop scanning, and the Stop button should break on press:</p>
  
  <pre><code>start = Button(app, text="Start Scan",command=scanning)
  stop = Button(app, text="Stop",command="break")
  
  start.grid()
  stop.grid()
  </code></pre>
  
  <p>However, when I hit the Start button, it is always pushed down (assuming because of the infinite loop). But, I <strong>cannot click on the Stop button</strong> to break out of the while loop.</p>