Документация Engee

Slider

Страница в процессе перевода.

Простой ползунок без метки. Создать метку можно, например, с помощью объекта Label. Необходимо указать диапазон, который ограничивает возможные значения ползунка.

Текущий выбранный интервал находится в атрибуте value. Не изменяйте это значение вручную, а воспользуйтесь функцией set_close_to!(slider, value). Это необходимо для того, чтобы значения действительно присутствовали в атрибуте range.

Дважды щелкните ползунок, чтобы вернуть для него значения (приблизительные), указанные в startvalue.

Если задать атрибут snap = false, ползунок будет двигаться непрерывно во время перетаскивания и перейдет к ближайшему доступному значению только при отпускании кнопки мыши.

using GLMakie

fig = Figure()

ax = Axis(fig[1, 1])

sl_x = Slider(fig[2, 1], range = 0:0.01:10, startvalue = 3, update_while_dragging=false)
sl_y = Slider(fig[1, 2], range = 0:0.01:10, horizontal = false, startvalue = 6)

point = lift(sl_x.value, sl_y.value) do x, y
    Point2f(x, y)
end

scatter!(point, color = :red, markersize = 20)

limits!(ax, 0, 10, 0, 10)

fig
454fc0b

Ползунки и сетки с метками

Функции labelslider! и labelslidergrid! устарели, используйте вместо них SliderGrid.

Атрибуты

MarkdownAST.Heading(3)

Defaults to Inside()

The align mode of the slider in its parent GridLayout.

MarkdownAST.Heading(3)

Defaults to COLOR_ACCENT[]

The color of the slider when the mouse clicks and drags the slider.

MarkdownAST.Heading(3)

Defaults to COLOR_ACCENT_DIMMED[]

The color of the slider when the mouse hovers over it.

MarkdownAST.Heading(3)

Defaults to RGBf(0.94, 0.94, 0.94)

The color of the slider when it is not interacted with.

MarkdownAST.Heading(3)

Defaults to :center

The horizontal alignment of the element in its suggested bounding box.

MarkdownAST.Heading(3)

Defaults to Auto()

The height setting of the element.

MarkdownAST.Heading(3)

Defaults to true

Controls if the slider has a horizontal orientation or not.

MarkdownAST.Heading(3)

Defaults to 10

The width of the slider line

MarkdownAST.Heading(3)

Defaults to 0:0.01:10

The range of values that the slider can pick from.

MarkdownAST.Heading(3)

Defaults to true

Controls if the button snaps to valid positions or moves freely

MarkdownAST.Heading(3)

Defaults to 0

The start value of the slider or the value that is closest in the slider range.

MarkdownAST.Heading(3)

Defaults to true

Controls if the parent layout can adjust to this element’s height

MarkdownAST.Heading(3)

Defaults to true

Controls if the parent layout can adjust to this element’s width

MarkdownAST.Heading(3)

Defaults to true

If false, slider only updates value once dragging stops

MarkdownAST.Heading(3)

Defaults to :center

The vertical alignment of the element in its suggested bounding box.

MarkdownAST.Heading(3)

Defaults to 0

The current value of the slider. Don’t set this manually, use the function set_close_to!.

MarkdownAST.Heading(3)

Defaults to Auto()

The width setting of the element.