Skip to content
Related Articles

Related Articles

How to create a frame inside a frame tkinter?

View Discussion
Improve Article
Save Article
  • Last Updated : 21 Jun, 2021
View Discussion
Improve Article
Save Article

Prerequisite: Tkinter

It is very easy to create a basic frame using Tkinter, this article focuses on how another frame can be created within it. To create a basic frame the name of the parent window is given as the first parameter to the frame() function. Therefore, to add another frame within this frame, just the name of the first frame needs to given to the second frame as the parent window.

Optional values such as frame padding are give relative to the parent window. We can add multiple frames in this fashion using the same approach, by making the previous frame the parent of the current frame.


  • Create Normal Tkinter Window
  • Create first frame normally
  • Create second frame
  • Take the first window as its parent window
  • Execute code

frame() is an inbuilt Tkinter method which helps realize our required functionality.

Syntax: frame(master)


  • master: parent window
  • highlightcolor: To set the color of the focus highlight when widget has to be focused.
  • bd: to set the border width in pixels.
  • bg: to set the normal background color.
  • cursor: to set the cursor used.
  • width: to set the width of the widget.
  • height: to set the height of the widget.



# Import Module
from tkinter import *
# Create Tkinter Object
root = Tk()
# Set Geometry
# Frame 1
frame1 = Frame(root,bg="black",width=500,height=300)
# Frame 2
frame2 = Frame(frame1,bg="white",width=100,height=100)
# Execute Tkinter






My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!