AnyMath 文档

菜单

该页面正在翻译中。

using GLMakie

fig = Figure()

menu = Menu(fig, options = ["viridis", "heat", "blues"], default = "blues")

funcs = [sqrt, x->x^2, sin, cos]

menu2 = Menu(fig,
    options = zip(["Square Root", "Square", "Sine", "Cosine"], funcs),
    default = "Square")

fig[1, 1] = vgrid!(
    Label(fig, "Colormap", width = nothing),
    menu,
    Label(fig, "Function", width = nothing),
    menu2;
    tellheight = false, width = 200)

ax = Axis(fig[1, 2])

func = Observable{Any}(funcs[1])

ys = lift(func) do f
    f.(0:0.3:10)
end
scat = scatter!(ax, ys, markersize = 10px, color = ys)

cb = Colorbar(fig[1, 3], scat)

on(menu.selection) do s
    scat.colormap = s
end
notify(menu.selection)

on(menu2.selection) do s
    func[] = s
    autolimits!(ax)
end
notify(menu2.selection)

fig

菜单方向

您可以更改菜单的方向 方向=:向上方向=:向下. 默认情况下,自动确定方向以避免图形边界处的截止。 </无翻译>

using GLMakie

fig = Figure()

menu = Menu(fig[1, 1], options = ["A", "B", "C"])
menu2 = Menu(fig[3, 1], options = ["A", "B", "C"])

menu.is_open = true
menu2.is_open = true

fig
c7a7ab9

属性

对齐模式

默认值为 里面()

菜单在其建议的边界框中的对齐方式。

细胞_颜色_活性

默认值为 颜色[]

激活时的单元格颜色

细胞颜色

默认值为 颜色_ACCENT_DIMED[]

悬浮时细胞颜色

cell_color_inactive_even

默认值为 RGBf(0.97,0.97,0.97)

甚至不活动时的细胞颜色

cell_color_inactive_odd

默认值为 RGBf(0.97,0.97,0.97)

不活动时的单元格颜色奇数

方向感

默认值为 自动的

菜单的打开方向(:向上或:向下)

默认值为 (:黑色,0.2)

下拉箭头的颜色

默认值为 10

下拉箭头的大小

字体大小

默认值为 @继承:字体大小16.0f0

单元格文本的字体大小

哈林

默认值为 :中心

菜单在其建议的边界框中的水平对齐.

身高

默认值为 汽车()

菜单的高度设置。

i_选择

默认值为 0

所选项目的索引。 不应由用户设置。

is_open

默认值为 错误

菜单是否显示可用选项

选项

默认值为 ["没有选择"]

菜单中选择的选项列表。 这可以是任何可迭代的字符串和容器的混合与一个字符串和一个其他值。 如果一个条目只是一个字符串,则该字符串既是标签又是选择。 如果一个条目是一个包含一个字符串和一个其他值的容器,则该字符串是标签,另一个值是选择。

提示

默认值为 "选择。.."

当i==0时提示选择的默认消息

滚动速度

默认值为 15.0

在大型菜单列表中滚动的速度。

选择

默认值为 什么都没有

选定的项目值。 这是您应该听的输出observable,以便对菜单交互做出反应。 不应由用户设置。

选择_cell_color_inactive

默认值为 RGBf(0.94,0.94,0.94)

不活动时选择单元格颜色

告诉我们

默认值为 真的

控制父布局是否可以调整到此元素的高度

告诉宽度

默认值为 真的

控制父布局是否可以调整到此元素的宽度

文本颜色

默认值为 :黑色

参赛文本的颜色

文本填充

默认值为 (8, 10, 8, 8)

输入文本的填充

n.英勇,英勇

默认值为 :中心

菜单在其建议的边界框中的垂直对齐.

阔度

默认值为 什么都没有

菜单的宽度设置。