import tkinter as tk
root = tk.Tk()
root.title("Pack Demo 1 - Vertical")
root.geometry("300x250")
# Создаем цветные блоки
tk.Label(root, text="Top", bg="red", fg="white").pack(fill='x', padx=5, pady=2)
tk.Label(root, text="Middle", bg="green", fg="white").pack(fill='x', padx=5, pady=2)
tk.Label(root, text="Bottom", bg="blue", fg="white").pack(fill='x', padx=5, pady=2)
root.mainloop()