Web Analytics Made Easy - Statcounter
Skip to content

Slider

Slider call reference

Create a horizontal or vertical slider for selecting values over a linear range. Value returned is always of type float.

layout = [[sg.Slider((1, 10), orientation='horizontal')]]

Events

The Slider element can create events anytime the slider is moved if the enable_events parameter is set to True.

Values Dictionary

The Values Dictionary entry for the Slider element is of type float, even if the range is integers. Note that the Qt and tkinter ports differ in the type in the dictionary.

Visual Options

There are a number of options available that you can enable. The default settings will show the current value of the slider as part of the element. The parameter disable_number_display controls if this value should be shown. You may want to display the current value at a different location than provided by the element itself. If so, you can turn off the display automatic display and add a Text element that you update in your event loop.

If you set the parameter tick_interval then a series of numbers will be added next to your slider to provide a guide for your user to know where to move the slider to in order to get a specific value.