A Tkinter GUI slider element that slides along user-defined intervals, rather than being limited to linear intervals as in the default slider element. Used in the refresh rate slider in the control panel.
This class inherits from tkinter.Frame
and will contain all the methods and properties of that class as well. These are not listed here.
Note that this is a Tkinter widget and thus will not work in other frontends like Jupyter notebooks. The recommended way to draw a log slider is with the higher-level Params.add()
instead, setting the type
parameter to 'slider'
and the opts
parameter to a list of int
s.
WARNING: This is an internal class. Its use in user code is not recommended or supported, and its signature can change in future updates without warning. Use one of the suggested functions above instead, if applicable.
Initialization Parameters
parent — tkinter.Frame, optional
The Tkinter frame to which the log slider should be attached.
Default value: None
title — str, optional
A label for the log slider, displayed above the slider element.
Default value: None
command — func(num), optional
A callback function that runs when the slider is changed, and is passed the value of the slider as its only argument.
Default value: None
bg — str, optional
The background hex color of the logSlider element.
Default value: '#FFFFFF'
font — tuple(str,int), optional
A font name/size pair.
Default value: ('Lucida Grande', 12)
values — list[num], optional
A list of discrete values that the slider should slide over.
Default value: []
**kwargs — optional
Additional arguments will be passed to the Tkinter Scale element, with the exception of
to
,from
, andshowvalue
. Re-specifying any of these arguments will result in an error. See the list of valid arguments that can be passed to the element.Default value: None
Methods
Click a method name for more detailed documentation.
disable( )
Disables interaction with the slider.
disabled( val )
Enables or disables interaction with the slider.
enable( )
Enables interaction with the slider.
get( )
Returns the current value of the slider.
set( val )
Set the value of the log slider. The slider can be set to a value other than those listed in
self.values
, but the position of the slider will not update if it is not.
Object Properties
values — list[num]
A list of discrete values that the slider should slide over.
Initial value: []
extCommand — func(num)
A callback function that runs when the slider is changed, and is passed the value of the slider as its only argument.
Initial value: None
slide — tkinter.Scale
The Tkinter slider element used in the log slider frame.
text — tkinter.Label
The text to the side indicating the current value of the slider.
number — num
The current value of the log slider.
Initial value: 0
Notes and Examples