Pack Manager

 

from tkinter import * # Import all definitions form tkinter

class PackManagerDemo:
    def __init__(self):
        window = Tk() # Create a window
        window.title("Pack Manager Demo 1") # Set title

        Label(window, text = "Blue", bg = "blue").pack()
        Label(window, text = "Red", bg = "red").pack(
            fill = BOTH, expand = 1)
        Label(window, text = "Green", bg = "green").pack(
            fill = BOTH)

        window.mainloop()
        
PackManagerDemo() # Create GUI

 

With Side

from tkinter import * # Import all definitions form tkinter

class PackManagerDemo:
    def __init__(self):
        window = Tk() # Create a window
        window.title("Pack Manager Demo 2") # Set title

        Label(window, text = "Blue", bg = "blue").pack(side = LEFT)
        Label(window, text = "Red", bg = "red").pack(
            side = LEFT, fill = BOTH, expand = 1)
        Label(window, text = "Green", bg = "green").pack(
            side = LEFT, fill = BOTH)

        window.mainloop()

PackManagerDemo() # Create GUI