Advertisement
Felanpro

Tkinter basics

Aug 2nd, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. from tkinter import * #Import every function from tkinter class.
  2.  
  3. root = Tk() #Create main window.
  4.  
  5. text1 = Label(root, text = "Hello World!", fg = "blue") #Label() function with some arguments. :)
  6. button1 = Button(root, text = "Click me!", bg = "green",) #Button function with some arguments. :]
  7. #text1 and button1 are widgets. Widgets are objects that you put in to your window/frame. xD
  8.  
  9. text1.pack() #Display the label.
  10. button1.pack()
  11. root.mainloop() #Keeps the program running until closed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement