How to create a button in Python

How to create a button in Python

 

#importing tkinter
from tkinter import *

#creating a root window
root = Tk()

#creating a window with specific dimensions
root.geometry("250x100")

#create a button with text and required action post button click
button = Button(root,text = "Click Here",command = root.destroy)

#adjust the button location
button.pack(side = 'left')
  
root.mainloop()

Post a Comment

0 Comments