Progressbar widget with rounded corners, border, variable support, indeterminate mode, and vertical orientation support.
Constructor
CTkProgressBar(master, width, height, corner_radius, border_width, bg_color,
fg_color, border_color, progress_color, variable, orientation,
mode, determinate_speed, indeterminate_speed)
width
int
default:"200 (horizontal) / 8 (vertical)"
Width of the progressbar in pixels
height
int
default:"8 (horizontal) / 200 (vertical)"
Height of the progressbar in pixels
bg_color
str | tuple[str, str]
default:"transparent"
Background color, accepts single color or tuple for light/dark mode
fg_color
str | tuple[str, str]
default:"theme"
Foreground color for the progressbar track
border_color
str | tuple[str, str]
default:"theme"
Border color
progress_color
str | tuple[str, str]
default:"theme"
Color of the progress indicator
variable
tkinter.Variable
default:"None"
Tkinter variable to automatically control the progress value
Orientation of the progressbar: “horizontal” or “vertical”
mode
Literal['determinate', 'indeterminate']
default:"determinate"
Mode of the progressbar. “determinate” for fixed progress, “indeterminate” for animated loading indicator
Speed multiplier for determinate mode animation when using .start()
Speed multiplier for indeterminate mode animation
Methods
set
Set the progress value for determinate mode.
Progress value between 0.0 and 1.0
get
Get the current progress value (0.0 to 1.0).
start
Start automatic animation mode. In determinate mode, the progress bar will loop continuously. In indeterminate mode, creates an animated loading indicator.
stop
Stop the automatic animation mode.
step
Manually increment the progress by one step (based on speed settings).
Configure widget parameters. Accepts all constructor parameters.
cget
.cget(attribute_name) -> any
Get the value of a widget attribute.
Usage Examples
Basic Determinate Progress
import customtkinter as ctk
app = ctk.CTk()
# Create a progress bar
progressbar = ctk.CTkProgressBar(app, width=300)
progressbar.pack(pady=20)
# Set progress to 50%
progressbar.set(0.5)
app.mainloop()
Indeterminate Mode (Loading Animation)
import customtkinter as ctk
app = ctk.CTk()
# Create indeterminate progress bar
progressbar = ctk.CTkProgressBar(
app,
width=300,
mode="indeterminate",
indeterminate_speed=1
)
progressbar.pack(pady=20)
# Start the loading animation
progressbar.start()
app.mainloop()
Vertical Progress Bar
import customtkinter as ctk
app = ctk.CTk()
progressbar = ctk.CTkProgressBar(
app,
orientation="vertical",
height=300
)
progressbar.pack(pady=20)
progressbar.set(0.7)
app.mainloop()
With Variable Binding
import customtkinter as ctk
import tkinter
app = ctk.CTk()
# Create a variable
progress_var = tkinter.DoubleVar(value=0.3)
# Bind to progressbar
progressbar = ctk.CTkProgressBar(
app,
width=300,
variable=progress_var
)
progressbar.pack(pady=20)
# Update progress by changing the variable
def update_progress():
current = progress_var.get()
if current < 1.0:
progress_var.set(current + 0.1)
app.after(500, update_progress)
update_progress()
app.mainloop()
Automatic Animation with Start/Stop
import customtkinter as ctk
app = ctk.CTk()
progressbar = ctk.CTkProgressBar(
app,
width=300,
determinate_speed=2 # Faster animation
)
progressbar.pack(pady=20)
start_button = ctk.CTkButton(
app,
text="Start",
command=progressbar.start
)
start_button.pack(pady=5)
stop_button = ctk.CTkButton(
app,
text="Stop",
command=progressbar.stop
)
stop_button.pack(pady=5)
app.mainloop()