import tkinter as tk
root = tk.Tk()
# create a canvas to enable scrolling
canvas = tk.Canvas(root)
canvas.pack(side='left', fill='both', expand=True)
# create a scrollbar
scrollbar = tk.Scrollbar(root, command=canvas.yview)
scrollbar.pack(side='right', fill='y')
# associate scrollbar with canvas
canvas.configure(yscrollcommand = scrollbar.set)
# create a frame inside the canvas to hold your content
frame = tk.Frame(canvas)
canvas.create_window((0,0), window=frame, anchor='nw')
# for this example, just create 50 labels to show the scrolling
for i in range(50):
tk.Label(frame, text=f'Label {i+1}').pack()
# update the scrollregion after starting 'mainloop'
# when all widgets are in canvas
frame.update()
canvas.config(scrollregion=canvas.bbox('all'))
root.mainloop()