# Python Tkinter GUI  ## Environment: VScode ### Import tkinter ```python= from tkinter import * ``` ### Establish the root ```python= root = Tk() root.mainloop() ``` ### Consists of Widgets! ```python= # Creating label widgets myLabel1 = Label(root, text="Hello World!") myLabel2 = Label(root, text="My name is Willie Hung!!") myLabel1.grid(row=0, column=0) myLabel2.grid(row=1, column=1) ``` Generate a user interface like this:  ### Create a function ```python= from tkinter import * root = Tk() def myClick(): myLabel = Label(root, text="Look! I clicked a label~") myLabel.pack() myButton = Button(root, text="Click Me!", command = myClick) myButton.pack() root.mainloop() ``` U can add a command when u push the button: 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up