tkinter show label code example
Example 1: python tkinter label
from Tkinter import *
root = Tk()
w = Label(root, text="Hello Tkinter!")
w.pack()
root.mainloop()
Example 2: add font to the label in window tkinter
import tkinter
window = tkinter.Tk()
window.title('my first GUI program')
window.minsize(width=600, height=500)
my_label = tkinter.Label(text='I am a Label', font=('Cursive', 24, 'bold'))
my_label.pack()
window.mainloop()
Example 3: how to create a label in tkinter
from tkinter import *
new_window = Tk()
new_window.title("My Python Project")
new_window.geometry("300x250")
Label(new_window, text = "Hello World").pack()
Example 4: tkinter label
from Tkinter import *
root = Tk()
var = StringVar()
label = Label( root, textvariable=var, relief=RAISED )
var.set("Hey!? How are you doing?")
label.pack()
root.mainloop()