Destroy the frame in tkinter python by R4R Team

- Frame() Tkinter widget is very important for the process of grouping and organizing other widgets. It works like a container, and content in one Frame do not affects the other Frame content.
-It uses rectangular areas in the screen to organize the layout and to provide padding of these widgets. A frame can also be used as a foundation class to implement complex widgets.

Destroy the frame-

Syntax-

frameobject.destroy()

Create a Frame-

program-

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

#create a two Frame
f1=Frame(win,height=150,width=400,bg="red")
f1.pack(side=TOP)

f2=Frame(win,height=250,width=400,bg="blue")
f2.pack(side=BOTTOM)


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

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

#hold the screen
win.mainloop()


output-



-In this program, we create a two frame inside the window screen, and two Label one in each Frame.

then by :

f2.destroy()

output-


then by :

f1.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!