Skip to main content

CTkSlider

Example Code

def slider_event(value):
print(value)

slider = customtkinter.CTkSlider(app, from_=0, to=100, command=slider_event)

Arguments

argumentvalue
masterroot, tkinter.Frame or CTkFrame
commandcallback function, receives slider value as argument
variabletkinter.IntVar or tkinter.DoubleVar object
widthslider width in px
heightslider height in px
border_widthspace around the slider rail in px
from_lower slider value
toupper slider value
number_of_stepsnumber of steps in which the slider can be positioned
fg_colorforeground color, tuple: (light_color, dark_color) or single color
progress_colortuple: (light_color, dark_color) or single color or "transparent", color of the slider line before the button
border_colorslider border color, tuple: (light_color, dark_color) or single color or "transparent", default is "transparent"
button_colorcolor of the slider button, tuple: (light_color, dark_color) or single color
button_hover_colorhover color, tuple: (light_color, dark_color) or single color
orientation"horizontal" (standard) or "vertical"
state"normal" or "disabled" (not clickable)
hoverbool, enable/disable hover effect, default is True

Methods

  • .configure(attribute=value, ...)

    All attributes can be configured and updated, for example:

    slider.configure(number_of_steps=25)
  • .cget(attribute_name)

    Pass attribute name as string and get current value of attribute.

  • .set(value)

    Set slider to specific value.

  • .get()

    Get current value of slider.

    value = slider.get()