enable.slider module

class enable.slider.Slider(**traits)[source]

Bases: enable.component.Component

A horizontal or vertical slider bar

dragging_left_up(event)[source]
dragging_mouse_leave(event)[source]
dragging_mouse_move(event)[source]
dragging_right_up(event)[source]
map_data(x, y, clip=True)[source]

Returns a value between min and max that corresponds to the given x and y values.

Parameters
  • x (Float) – The screen coordinates to map

  • y (Float) – The screen coordinates to map

  • clip (Bool (default=True)) – Whether points outside the range should be clipped to the max or min value of the slider (depending on which it’s closer to)

Returns

value

Return type

Float

map_screen(val)[source]

Returns an (x,y) coordinate corresponding to the location of val on the slider.

normal_left_down(event)[source]
normal_right_down(event)[source]
set_endcap_percent(percent)[source]

Sets the width of the endcap to be a percentage of the width of the endcap widget.

Parameters

percent (float) – The percentage, between 0.0 and 1.0

set_endcap_pixels(pixels)[source]

Sets the width of the endcap to be a fixed number of pixels

Parameters

pixels (int) – The number of pixels wide that the endcap should be

set_range(min, max)[source]
set_slider_percent(percent)[source]

Sets the width of the slider to be a percentage of the width of the slider widget.

Parameters

percent (float) – The percentage, between 0.0 and 1.0

set_slider_pixels(pixels)[source]

Sets the width of the slider to be a fixed number of pixels

Parameters

pixels (int) – The number of pixels wide that the slider should be

set_tick_percent(percent)[source]

Sets the width of the tick marks to be a percentage of the width of the endcap widget.

Parameters

percent (float) – The percentage, between 0.0 and 1.0

set_tick_pixels(pixels)[source]

Sets the width of the tick marks to be a fixed number of pixels

Parameters

pixels (int) – The number of pixels wide that the endcap should be