- 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.
Syntax-
Frame(window,option,...)
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()