Label in Tkinter
Label is a type of widget which is used to provide a single-line caption. It can be used as a caption for other widgets. Tkinter Label widget is used to display a text or image on the screen.
A label can only display text in a single font. The text can span multiple lines. It is Used to Specify container box where we can place the text or images others.
Syntax: lbl = Label(root, options)
root: It Represent Parent Window.
options: used as key value separated by Commas.
First Example of Level:
from tkinter import *
my_window = Tk()
my_window.title("Label Window") # Main window name
my_window.config(bg="#B4EEB4") #Main Window Backgroud Color
my_window.geometry("800x400+450+86") # width=800,Height=400,
#Xposition=450, Ypostition=86
lbl = Label(my_window, text="I Am Label Window")
lbl.pack()
my_window.mainloop()
my_window = Tk()
my_window.title("Label Window") # Main window name
my_window.config(bg="#B4EEB4") #Main Window Backgroud Color
my_window.geometry("800x400+450+86") # width=800,Height=400,
#Xposition=450, Ypostition=86
lbl = Label(my_window, text="I Am Label Window")
lbl.pack()
my_window.mainloop()
Post a Comment