I've seen the following code for binding the Escape Key to a Tkinter GUI:
import Tkinter as tk
def exit():
root.destroy()
root = tk.Tk()
root.bind("<Escape>", exit)
root.mainloop()
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?