wx.Slider

Inheritance diagram for wx.Slider:



Description

A slider is a control with a handle which can be pulled back and forth to change the value.

On Windows, the track bar control is used.

Slider events are handled in the same way as a scrollbar.

See also

wx.ScrollBar

Window Styles

Window Style Description
wx.SL_HORIZONTAL Displays the slider horizontally (this is the default).
wx.SL_VERTICAL Displays the slider vertically.
wx.SL_AUTOTICKS Displays tick marks.
wx.SL_LABELS Displays minimum, maximum and value labels.
wx.SL_LEFT Displays ticks on the left and forces the slider to be vertical.
wx.SL_RIGHT Displays ticks on the right and forces the slider to be vertical.
wx.SL_TOP Displays ticks on the top.
wx.SL_BOTTOM Displays ticks on the bottom (this is the default).
wx.SL_SELRANGE Allows the user to select a range on the slider. Windows only.
wx.SL_INVERSE Inverses the mininum and maximum endpoints on the slider. Not compatible with wx.SL_SELRANGE.

Event Handling

To process a scroll event, use these event handler macros to direct input to member functions that take a wx.ScrollEvent argument. You can use EVT_COMMAND_SCROLL... macros with window IDs for when intercepting scroll events from controls, or EVT_SCROLL... macros without window IDs for intercepting scroll events from the receiving window – except for this, the macros behave exactly the same.

Event Name Description
wx.EVT_SCROLL(func) Process all scroll events.
wx.EVT_SCROLL_TOP(func) Process wx.wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
wx.EVT_SCROLL_BOTTOM(func) Process wx.wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
wx.EVT_SCROLL_LINEUP(func) Process wx.wxEVT_SCROLL_LINEUP line up events.
wx.EVT_SCROLL_LINEDOWN(func) Process wx.wxEVT_SCROLL_LINEDOWN line down events.
wx.EVT_SCROLL_PAGEUP(func) Process wx.wxEVT_SCROLL_PAGEUP page up events.
wx.EVT_SCROLL_PAGEDOWN(func) Process wx.wxEVT_SCROLL_PAGEDOWN page down events.
wx.EVT_SCROLL_THUMBTRACK(func) Process wx.wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent as the user drags the thumbtrack).
wx.EVT_SCROLL_THUMBRELEASE(func) Process wx.wxEVT_SCROLL_THUMBRELEASE thumb release events.
wx.EVT_SCROLL_CHANGED(func) Process wx.wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).
wx.EVT_COMMAND_SCROLL(id, func) Process all scroll events.
wx.EVT_COMMAND_SCROLL_TOP(id, func) Process wx.wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
wx.EVT_COMMAND_SCROLL_BOTTOM(id, func) Process wx.wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
wx.EVT_COMMAND_SCROLL_LINEUP(id, func) Process wx.wxEVT_SCROLL_LINEUP line up events.
wx.EVT_COMMAND_SCROLL_LINEDOWN(id, func) Process wx.wxEVT_SCROLL_LINEDOWN line down events.
wx.EVT_COMMAND_SCROLL_PAGEUP(id, func) Process wx.wxEVT_SCROLL_PAGEUP page up events.
wx.EVT_COMMAND_SCROLL_PAGEDOWN(id, func) Process wx.wxEVT_SCROLL_PAGEDOWN page down events.
wx.EVT_COMMAND_SCROLL_THUMBTRACK(id, func) Process wx.wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent as the user drags the thumbtrack).
wx.EVT_COMMAND_SCROLL_THUMBRELEASE(func) Process wx.wxEVT_SCROLL_THUMBRELEASE thumb release events.
wx.EVT_COMMAND_SCROLL_CHANGED(func) Process wx.wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).

Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


Class API

Methods

__init__(parent, id=-1, value=0, minValue=0, maxValue=100, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.SL_HORIZONTAL, validator=wx.DefaultValidator, name=wx.SliderNameStr)

Constructor, creating and showing a slider.

Parameters:


Returns:

wx.Slider


ClearSel()
Clears the selection, for a slider with the wx.SL_SELRANGE style.

Note

Windows 95 only.


ClearTicks()
Clears the ticks.

Note

Windows 95 only.


GetLineSize()

Returns the line size.


Returns:

int

See also

SetLineSize


GetMax()

Gets the maximum slider value.


Returns:

int

See also

GetMin, SetRange


GetMin()

Gets the minimum slider value.


Returns:

int

See also

GetMin, SetRange


GetPageSize()

Returns the page size.


Returns:

int

See also

SetPageSize


GetRange()
No docstrings available for this method.

GetSelEnd()

Returns the selection end point.


Returns:

int

Note

Windows 95 only.


GetSelStart()

Returns the selection start point.


Returns:

int

Note

Windows 95 only.


GetThumbLength()

Returns the thumb length.


Returns:

int

Note

Windows 95 only.

See also

SetThumbLength


GetTickFreq()

Returns the tick frequency.


Returns:

int

Note

Windows 95 only.

See also

SetTickFreq


GetValue()

Gets the current slider value.


Returns:

int

See also

GetMin, GetMax, SetValue


SetLineSize(lineSize)

Sets the line size for the slider.

Parameters:

  • lineSize (int): The number of steps the slider moves when the user moves it up or down a line.

See also

GetLineSize


SetMax(maxValue)

Parameters:

  • maxValue (int)

SetMin(minValue)

Parameters:

  • minValue (int)

SetPageSize(pageSize)

Sets the page size for the slider.

Parameters:

  • pageSize (int): The number of steps the slider moves when the user pages up or down.

See also

GetPageSize


SetRange(minValue, maxValue)

Sets the minimum and maximum slider values.

Parameters:

  • minValue (int)
  • maxValue (int)

See also

GetMin, GetMax


SetSelection(min, max)

Sets the selection.

Parameters:

  • min (int)
  • max (int)

Note

Windows 95 only.


SetThumbLength(lenPixels)

Sets the slider thumb length.

Parameters:

  • lenPixels (int)

Note

Windows 95 only.

See also

GetThumbLength


SetTick(tickPos)

Sets a tick position.

Parameters:

  • tickPos (int)

Note

Windows 95 only.

See also

SetTickFreq


SetTickFreq(n, pos=1)

Sets the tick mark frequency and position.

Parameters:

  • n (int): Frequency. For example, if the frequency is set to two, a tick mark is displayed for every other increment in the slider’s range.
  • pos (int): Position. Must be greater than zero.

Note

Windows 95 only.

See also

GetTickFreq


SetValue(value)

Sets the slider position.

Parameters:

  • value (int): The slider position.

Properties

LineSize
See GetLineSize and SetLineSize
Max
See GetMax and SetMax
Min
See GetMin and SetMin
PageSize
See GetPageSize and SetPageSize
SelEnd
See GetSelEnd
SelStart
See GetSelStart
ThumbLength
See GetThumbLength and SetThumbLength
TickFreq
See GetTickFreq and SetTickFreq
Value
See GetValue and SetValue