tkinter add button and function code example
Example 1: python button tkinter
from tkinter import *
wow = Tk()
def ree(hi):
print(hi)
w = Button ( master=wow, command=ree('hi'), text="hi" )
Output:
Tkinter:
______
[ hi ] <--- Button
------
Shell:
hi <--- on button pressed
Example 2: add a button on tkinter
import tkinter
button1 = ttk.Button(self, text="anything", command=random command)
button1.pack()