from Tkinter import *

class Example3:
    def __init__ (self, master):
        self.lbl = Label(master, text="Press the button below to exit")
        self.lbl.pack()
        self.btn = Button(master, text="Quit", command=self.quit)
        self.btn.pack()

    def quit(self):
        import sys; sys.exit()

root = Tk()
ex3 = Example3(root)
root.mainloop()