In this video I’ll show you how to use scrollable frames with CustomTkinter and Python.

In regular Tkinter, you need to add a scrollbar to a frame to make it scrollable, but in CustomTkinter there’s a widget that comes with a scrollbar!

So no extra coding! Let’s dive into it!

Python Code: ctk_scroll.py
(Github Code)

from tkinter import *
import customtkinter

customtkinter.set_appearance_mode("dark")  # Modes: system (default), light, dark
customtkinter.set_default_color_theme("dark-blue")  # Themes: blue (default), dark-blue, green

#root = Tk()
root = customtkinter.CTk()

root.title('Tkinter.com - Custom Tkinter Scrollable Frame!')
root.iconbitmap('images/codemy.ico')
root.geometry('700x300')

# Create a scrollable frame
my_frame = customtkinter.CTkScrollableFrame(root,
	orientation="vertical",
	width=300,
	height=200,
	label_text="Hello World!",
	label_fg_color="blue",
	label_text_color="yellow",
	label_font=("Helvetica", 18),
	label_anchor = "center", # "w",  # n, ne, e, se, s, sw, w, nw, center
	border_width=3,
	border_color="green",
	fg_color="red",
	scrollbar_fg_color="yellow",
	scrollbar_button_color="pink",
	scrollbar_button_hover_color = "blue",
	corner_radius = 20,








	)
my_frame.pack(pady=40)


# for loop for buttons
for x in range(20):
	customtkinter.CTkButton(my_frame, text="This is a Button!!").pack(pady=10)







root.mainloop()


John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

Add comment

Your email address will not be published. Required fields are marked *

John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of...