Button
|
Страница в процессе перевода. |
using GLMakie
fig = Figure()
ax = Axis(fig[1, 1])
fig[2, 1] = buttongrid = GridLayout(tellwidth = false)
counts = Observable([1, 4, 3, 7, 2])
buttonlabels = [lift(x -> "Count: $(x[i])", counts) for i in 1:5]
buttons = buttongrid[1, 1:5] = [Button(fig, label = l) for l in buttonlabels]
for i in 1:5
on(buttons[i].clicks) do n
counts[][i] += 1
notify(counts)
end
end
barplot!(counts, color = cgrad(:Spectral)[LinRange(0, 1, 5)])
ylims!(ax, 0, 20)
fig
Атрибуты
MarkdownAST.Heading(3)
Defaults to Inside()
The align mode of the button in its parent GridLayout.
MarkdownAST.Heading(3)
Defaults to RGBf(0.94, 0.94, 0.94)
The color of the button.
MarkdownAST.Heading(3)
Defaults to COLOR_ACCENT[]
The color of the button when the mouse clicks the button.
MarkdownAST.Heading(3)
Defaults to COLOR_ACCENT_DIMMED[]
The color of the button when the mouse hovers over the button.
MarkdownAST.Heading(3)
Defaults to 0
The number of clicks that have been registered by the button.
MarkdownAST.Heading(3)
Defaults to 4
The radius of the rounded corners of the button.
MarkdownAST.Heading(3)
Defaults to 10
The number of poly segments used for each rounded corner.
MarkdownAST.Heading(3)
Defaults to :regular
The font family of the button label.
MarkdownAST.Heading(3)
Defaults to @inherit :fontsize 16.0f0
The font size of the button label.
MarkdownAST.Heading(3)
Defaults to :center
The horizontal alignment of the button in its suggested boundingbox
MarkdownAST.Heading(3)
Defaults to Auto()
The height setting of the button.
MarkdownAST.Heading(3)
Defaults to "Button"
The text of the button label.
MarkdownAST.Heading(3)
Defaults to @inherit :textcolor :black
The color of the label.
MarkdownAST.Heading(3)
Defaults to :white
The color of the label when the mouse clicks the button.
MarkdownAST.Heading(3)
Defaults to :black
The color of the label when the mouse hovers over the button.
MarkdownAST.Heading(3)
Defaults to (8.0f0, 8.0f0, 8.0f0, 8.0f0)
The extra space added to the sides of the button label’s boundingbox.
MarkdownAST.Heading(3)
Defaults to :transparent
The color of the button border.
MarkdownAST.Heading(3)
Defaults to 2.0
The line width of the button border.
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 :center
The vertical alignment of the button in its suggested boundingbox
MarkdownAST.Heading(3)
Defaults to Auto()
The width setting of the button.