adds callbacks function to a button
import sys from Tkinter import * widget = Button(None, text='Hello', command=sys.exit) widget.pack() widget.mainloop()