Using the Pack geometry manager
In previous recipes, we have seen that creating a widget does not automatically display it on the screen. We have called the pack()
method on each widget to do so, which means that we used the Pack geometry manager.
This is one of the three available geometry managers in Tkinter, and it is well suited for simple layouts, such as when you want to place all the widgets on top of each other or side by side.
Getting ready
Let's suppose that we want to achieve the following layout in our application:

It consists of three rows, where the last one has three widgets placed side by side. In this scenario, the Pack geometry manager can easily add the widgets as expected, without the need for additional frames.
How to do it…
We will use five Label
widgets with different texts and background colors to help us identify each rectangular region:
import tkinter as tk class App(tk.Tk): def __init__(self): super().__init__() label_a = tk.Label(self, text="Label...