<p>How do I end a Tkinter program? Let's say I have this code:</p>

<pre><code>from Tkinter import *

def quit():
    # code to exit

root = Tk()
Button(root, text="Quit", command=quit).pack()
root.mainloop()
</code></pre>

<p>How should I define the <code>quit</code> function to exit my application?</p>

```
```
def quit()
    root.quit()
```
```
or
```
```
def quit()
    root.destroy()
```
```