fsleyes_widgets.floatslider
This module provides two classes, the FloatSlider
and
SliderSpinPanel
, which allow the user to modify floating point
values.
- class fsleyes_widgets.floatslider.FloatSlider(parent, value=None, minValue=None, maxValue=None, style=0)[source]
Bases:
Panel
Floating point slider widget.
This class is an alternative to
wx.Slider
, which supports floating point numbers of any range. The desired range is transformed into the internal range \([-2^{31}, 2^{31-1}]\).A
EVT_SLIDER
event is emitted whenever the user changes the value.Create a
FloatSlider
.The following style flags are available:
If set, mouse wheel events on the slider will change the value.
If set, the slider will store an integer value instead of a floating point value.
- Parameters:
parent – The
wx
parent object.value – Initial slider value.
minValue – Minimum slider value.
maxValue – Maximum slider value.
style – A combination of
FS_MOUSEWHEEL
andFS_INTEGER
.
- class fsleyes_widgets.floatslider.SliderSpinPanel(parent, value=None, minValue=None, maxValue=None, label=None, style=None, spinWidth=None, precision=None)[source]
Bases:
Panel
A panel containing a
FloatSlider
and aFloatSpinCtrl
.The slider and spinbox are linked such that changes to one are reflected in the other. The
SliderSpinPanel
class also provides the option to have the minimum/maximum limits displayed on either side of the slider/spinbox, and to have those limits editable via aNumberDialog
.Users of the
SliderSpinPanel
may wish to bind listeners to the following events:EVT_SSP_VALUE
: Emitted when the slider value changes.EVT_SSP_LIMIT
: Emitted when the slider limits change.
Create a
SliderSpinPanel
.The following style flags are available:
If set, the data range limits are shown alongside the slider/spin control widgets.
If set, and
SSP_SHOW_LIMITS
is also set, the data range limits are shown on buttons alongside the slider/spin control widgets.If set, mouse wheel events on the slider/spin controls will change the value.
If set, the
SliderSpinPanel
will store an integer value instead of floating point value.- Parameters:
parent – A parent control.
value – Initial slider/spin value.
minValue – Minimum slider/spin value.
maxValue – Maximum slider/spin value.
label – If not
None
, awx.StaticText
widget is added to the left of the slider, containing the given label.style – A combination of
SSP_SHOW_LIMITS
,SSP_EDIT_LIMITS
,SSP_NO_LIMITS
,SSP_MOUSEWHEEL
andSSP_INTEGER
. Defaults toSSP_SHOW_LIMITS
.spinWidth – Desired spin control width in characters. Defaults to 6. See the
FloatSpinCtrl
class.
- property slider
Returts a reference to the
FloatSlider
contained in thisSliderSpinPanel
.
- property spinCtrl
Returts a reference to the
FloatSpinCtrl
contained in thisSliderSpinPanel
.
- fsleyes_widgets.floatslider.FS_MOUSEWHEEL = 1
If set, mouse wheel events on the slider will change the value.
- fsleyes_widgets.floatslider.FS_INTEGER = 2
If set, the slider will store an integer value instead of a floating point value.
- fsleyes_widgets.floatslider.EVT_SSP_VALUE = <wx.core.PyEventBinder object>
Identifier for the
SliderSpinValueEvent
.
- fsleyes_widgets.floatslider.EVT_SSP_LIMIT = <wx.core.PyEventBinder object>
Identifier for the
SliderSpinLimitEvent
.
- fsleyes_widgets.floatslider.SliderSpinValueEvent
Event emitted when the
SliderSpinPanel
value changes. Contains a single attribute,value
, which contains the new value.
- fsleyes_widgets.floatslider.SliderSpinLimitEvent
Event emitted when the
SliderSpinPanel
limits change. Contains two attributes,min
andmax
, which contain the new limit values.
- fsleyes_widgets.floatslider.SSP_SHOW_LIMITS = 1
If set, the data range limits are shown alongside the slider/spin control widgets.
- fsleyes_widgets.floatslider.SSP_EDIT_LIMITS = 2
If set, and
SSP_SHOW_LIMITS
is also set, the data range limits are shown on buttons alongside the slider/spin control widgets.When the user pushes the button, a
NumberDialog
is shown, allowing the user to change the data range.
- fsleyes_widgets.floatslider.SSP_MOUSEWHEEL = 4
If set, mouse wheel events on the slider/spin controls will change the value.
- fsleyes_widgets.floatslider.SSP_INTEGER = 8
If set, the
SliderSpinPanel
will store an integer value instead of floating point value.
- fsleyes_widgets.floatslider.SSP_NO_LIMITS = 16
If set, the user is able to enter values outside of the range into the spin controls.