Delete the Label in Tkinter python by R4R Team

Syntax-

labelobject.destroy()


program-

from tkinter import *
#create a window screen
win=Tk()
win.geometry("400x350")

#create a First Label
l1=Label(win,text="First Text",font=('',20,'bold'))
l1.place(x=30,y=30)
l1.config(bg="Red",fg="white")

#create a second label
l2=Label(win,text="Second Text",font=('',15,'bold'))
l2.place(x=100,y=100)
l2.config(bg="blue",fg="white")

#create third label
l3=Label(win,text="Third Text",font=('',25,'bold'))
l3.place(x=120,y=200)
l3.config(bg="green",fg="white")

#hold the screen
win.mainloop()


output-


-In this program, we create a three different Label and show in window in above output.

Then by:

l1.destroy()

output-



Then by:

l2.destroy()

output-



Then by:


l1.destroy()
l2.destroy()
l3.destroy()

output-





Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!