button function tkinter code example
Example: add button python
from tkinter import *
master = Tk()
#program you want the button to execute
def closewindow():
exit()
#set up button
button = Button(master, text="close window", command=closewindow)
button.pack()
mainloop()