In this video I’ll show you how to use Sliders in CustomTkinter and Python.

Sliders are a great tool that you’ll use all the time. They allow you to adjust all sorts of things.

We’ll look at both horizontal sliders and vertical sliders for CustomTkinter. I’ll also show you how to customize the look of them.

Python Code: ctk_slider.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 Slider')
root.iconbitmap('images/codemy.ico')
root.geometry('700x300')

# Function
def sliding(value):
	my_label.configure(text=int(value))


my_slider = customtkinter.CTkSlider(root, 
	from_=0,
	to=100,
	command=sliding,
	orientation="horizontal",
	number_of_steps=10,
	width=400,
	height=50,
	#border_width=100,
	fg_color="red",
	progress_color="green",
	button_color="yellow",
	button_hover_color="orange",
	state="normal",
	hover=False



	)

my_slider.pack(pady=40)

# Define starting point
my_slider.set(0)

my_label = customtkinter.CTkLabel(root, text=my_slider.get(), font=("Helvetica", 18))
my_label.pack(pady=20)



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...