I've seen the following code for binding the Escape Key to a Tkinter GUI:

import Tkinter as tk

def exit():

root = tk.Tk()
root.bind("<Escape>", exit)

However, when I add this to my GUI program, I don't get a response when Esc key is pressed. It does nothing. Any suggestions?