1from Tkinter import *
2
3root = Tk()
4
5w = Label(root, text="Hello Tkinter!")
6w.pack()
7
8root.mainloop()
9
1#How to create a label in Tkinter
2
3from tkinter import *
4
5#First create a screen
6new_window = Tk()
7new_window.title("My Python Project")
8new_window.geometry("300x250")
9
10Label(new_window, text = "Hello World").pack()
11#Label : Tells Python that a label is being created
12#new_window : whatever screen you want the label to be shown on ; name the screen whatever you like
13#text : this tells that there is text being typed in the label
14#.pack() : shows the label on the screen
1from Tkinter import *
2
3root = Tk()
4var = StringVar()
5label = Label( root, textvariable=var, relief=RAISED )
6
7var.set("Hey!? How are you doing?")
8label.pack()
9root.mainloop()