button function in python code example
Example 1: how to create a button python
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()
Example 2: add a button on tkinter
import tkinter
button1 = ttk.Button(self, text="anything", command=random command)
button1.pack()