OrangoMango

Tkinter tutorial

May 7th, 2020
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. #Tkinter Tutorial
  2.  
  3. from tkinter import * #Import tkinter module
  4.  
  5. tk = Tk() #Create a tk window
  6. tk.title("Tkinter Hello World Program") #Set title of the widow
  7.  
  8. def output(): #Button function
  9.     print("You clicked me")
  10.  
  11. #Create a button widget, with text "click me" and command output function  
  12. b = Button(tk, text="click me", command=output)
  13. #Create button, show button on window
  14. b.pack()
  15.  
  16. tk.mainloop() #Tkinter mainloop, the windows remains open
Add Comment
Please, Sign In to add comment