Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Hutchinson josephhutch

View GitHub Profile
@josephhutch
josephhutch / TkinterScrollExample.py
Created December 14, 2018 16:14
Tkinter: Adding scrollbars to a container that changes size or is dynamically sized
View TkinterScrollExample.py
import tkinter as tk
root = tk.Tk()
# Tkinter widgets needed for scrolling. The only native scrollable container that Tkinter provides is a canvas.
# A Frame is needed inside the Canvas so that widgets can be added to the Frame and the Canvas makes it scrollable.
cTableContainer = tk.Canvas(root)
fTable = tk.Frame(cTableContainer)
sbHorizontalScrollBar = tk.Scrollbar(root)
sbVerticalScrollBar = tk.Scrollbar(root)