Skip to content

Instantly share code, notes, and snippets.

View josephhutch's full-sized 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
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)