********* wx.Slider ********* Inheritance diagram for `wx.Slider`: | .. inheritance-diagram:: 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. .. seealso:: `wx.ScrollBar `_ Derived From ^^^^^^^^^^^^^ * `wx.Control `_ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ 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 <../Events/wx.ScrollEvent.html>`_ 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 ^^^^^^^^^^^^^^^^^^ | .. figure:: ../images/wxWidgets/wxmsw/slider.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: ../images/wxWidgets/wxmac/slider.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: ../images/wxWidgets/wxgtk/slider.png :alt: wxGTK :figclass: floatcenter **wxGTK** | Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `ClearSel <#ClearSel>`_ * `ClearTicks <#ClearTicks>`_ * `GetLineSize <#GetLineSize>`_ * `GetMax <#GetMax>`_ * `GetMin <#GetMin>`_ * `GetPageSize <#GetPageSize>`_ * `GetRange <#GetRange>`_ * `GetSelEnd <#GetSelEnd>`_ * `GetSelStart <#GetSelStart>`_ * `GetThumbLength <#GetThumbLength>`_ * `GetTickFreq <#GetTickFreq>`_ * `GetValue <#GetValue>`_ * `SetLineSize <#SetLineSize>`_ * `SetMax <#SetMax>`_ * `SetMin <#SetMin>`_ * `SetPageSize <#SetPageSize>`_ * `SetRange <#SetRange>`_ * `SetSelection <#SetSelection>`_ * `SetThumbLength <#SetThumbLength>`_ * `SetTick <#SetTick>`_ * `SetTickFreq <#SetTickFreq>`_ * `SetValue <#SetValue>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `LineSize <#LineSize>`_ * `Max <#Max>`_ * `Min <#Min>`_ * `PageSize <#PageSize>`_ * `SelEnd <#SelEnd>`_ * `SelStart <#SelStart>`_ * `ThumbLength <#ThumbLength>`_ * `TickFreq <#TickFreq>`_ * `Value <#Value>`_ Class API ========= Methods ^^^^^^^ .. method:: __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:** * `parent` (`wx.Window `_) * `id` (int) * `value` (int) * `minValue` (int) * `maxValue` (int) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `style` (long) * `validator` (`wx.Validator `_) * `name` (string) | **Returns:** `wx.Slider `_ -------- .. method:: ClearSel() Clears the selection, for a slider with the ``wx.SL_SELRANGE`` style. .. note:: Windows 95 only. -------- .. method:: ClearTicks() Clears the ticks. .. note:: Windows 95 only. -------- .. method:: GetLineSize() Returns the line size. | **Returns:** `int` .. seealso:: `SetLineSize <#SetLineSize>`_ -------- .. method:: GetMax() Gets the maximum slider value. | **Returns:** `int` .. seealso:: `GetMin <#GetMin>`_, `SetRange <#SetRange>`_ -------- .. method:: GetMin() Gets the minimum slider value. | **Returns:** `int` .. seealso:: `GetMin <#GetMin>`_, `SetRange <#SetRange>`_ -------- .. method:: GetPageSize() Returns the page size. | **Returns:** `int` .. seealso:: `SetPageSize <#SetPageSize>`_ -------- .. method:: GetRange() `No docstrings available for this method.` -------- .. method:: GetSelEnd() Returns the selection end point. | **Returns:** `int` .. note:: Windows 95 only. .. seealso:: `GetSelStart <#GetSelStart>`_, `SetSelection <#SetSelection>`_ -------- .. method:: GetSelStart() Returns the selection start point. | **Returns:** `int` .. note:: Windows 95 only. .. seealso:: `GetSelEnd <#GetSelEnd>`_, `SetSelection <#SetSelection>`_ -------- .. method:: GetThumbLength() Returns the thumb length. | **Returns:** `int` .. note:: Windows 95 only. .. seealso:: `SetThumbLength <#SetThumbLength>`_ -------- .. method:: GetTickFreq() Returns the tick frequency. | **Returns:** `int` .. note:: Windows 95 only. .. seealso:: `SetTickFreq <#SetTickFreq>`_ -------- .. method:: GetValue() Gets the current slider value. | **Returns:** `int` .. seealso:: `GetMin <#GetMin>`_, `GetMax <#GetMax>`_, `SetValue <#SetValue>`_ -------- .. method:: 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. .. seealso:: `GetLineSize <#GetLineSize>`_ -------- .. method:: SetMax(maxValue) | **Parameters:** * `maxValue` (int) -------- .. method:: SetMin(minValue) | **Parameters:** * `minValue` (int) -------- .. method:: 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. .. seealso:: `GetPageSize <#GetPageSize>`_ -------- .. method:: SetRange(minValue, maxValue) Sets the minimum and maximum slider values. **Parameters:** * `minValue` (int) * `maxValue` (int) .. seealso:: `GetMin <#GetMin>`_, `GetMax <#GetMax>`_ -------- .. method:: SetSelection(min, max) Sets the selection. **Parameters:** * `min` (int) * `max` (int) .. note:: Windows 95 only. .. seealso:: `GetSelStart <#GetSelStart>`_, `GetSelEnd <#GetSelEnd>`_ -------- .. method:: SetThumbLength(lenPixels) Sets the slider thumb length. **Parameters:** * `lenPixels` (int) .. note:: Windows 95 only. .. seealso:: `GetThumbLength <#GetThumbLength>`_ -------- .. method:: SetTick(tickPos) Sets a tick position. **Parameters:** * `tickPos` (int) .. note:: Windows 95 only. .. seealso:: `SetTickFreq <#SetTickFreq>`_ -------- .. method:: 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. .. seealso:: `GetTickFreq <#GetTickFreq>`_ -------- .. method:: SetValue(value) Sets the slider position. **Parameters:** * `value` (int): The slider position. -------- Properties ^^^^^^^^^^ .. attribute:: LineSize See `GetLineSize <#GetLineSize>`_ and `SetLineSize <#SetLineSize>`_ .. attribute:: Max See `GetMax <#GetMax>`_ and `SetMax <#SetMax>`_ .. attribute:: Min See `GetMin <#GetMin>`_ and `SetMin <#SetMin>`_ .. attribute:: PageSize See `GetPageSize <#GetPageSize>`_ and `SetPageSize <#SetPageSize>`_ .. attribute:: SelEnd See `GetSelEnd <#GetSelEnd>`_ .. attribute:: SelStart See `GetSelStart <#GetSelStart>`_ .. attribute:: ThumbLength See `GetThumbLength <#GetThumbLength>`_ and `SetThumbLength <#SetThumbLength>`_ .. attribute:: TickFreq See `GetTickFreq <#GetTickFreq>`_ and `SetTickFreq <#SetTickFreq>`_ .. attribute:: Value See `GetValue <#GetValue>`_ and `SetValue <#SetValue>`_