from tkinter import * def example(): print("Example") root = Tk() clickMe = Button(root, text="Click Me", command=example) #Would Print "Example" In The CL
import Tkinter import tkMessageBox top = Tkinter.Tk() def helloCallBack(): tkMessageBox.showinfo( "Hello Python", "Hello World") B = Tkinter.Button(top, text ="Hello", command = helloCallBack) B.pack() top.mainloop()
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