我无法找到如何执行以下操作。使用Manipulate时,会自动在控件末尾显示一个小‘+’,如下
Manipulate[x,
{{x, 0, "x"}, 0, 1, .1, Appearance -> "Labeled"}
]
现在,我想使用 Dynamic 自己直接设置控件,并使其看起来像上面一样,如下所示:(顺便说一句,感谢 Simon 展示了执行此操作的正确语法 here
Manipulate[x,
{{xChanged, False}, None},
Grid[{
{"x ",
Slider[Dynamic[x, (x = #; xChanged = True; #) &], {0, 1, .1}],
Spacer[2],
Dynamic@x
}
}, Frame -> None, Spacings -> {0.2, 0.1}, Alignment -> Center]
]
现在,唯一缺少的是小“+”。我无法使用上面的 AppearanceElement 选项。所以,接下来我尝试了这个
Manipulate[x,
{{xChanged, False}, None},
Grid[{
{"x ",
Animator[Dynamic[x, (x = #; xChanged = True; #) &], {0, 1, .1},
AnimationRunning -> False], Spacer[2],
Dynamic@x
}
}, Frame -> None, Spacings -> {0.2, 0.1}, Alignment -> Center]
]
但这给出了太多。使用 Manipulate 时,我只需要标记为“显示动画控件”的“+”。但我找不到与此匹配的元素。
奇怪的是,很难找到这些元素的名称。我去ref/AppearanceElements
它甚至没有列出名字。当我去ref/Manipulate
时它在“外观元素”选项 {"HideControlsButton", "SnapshotButton", "ResetButton", "UpdateButton"
下提到了以下内容我尝试了所有这些,但它们不是我想要的。
我去了 ref/Manipulator,看到了这些 "InputField", "StepLeftButton", "PlayPauseButton", "StepRightButton", "FasterSlowerButtons", "DirectionButton", "InlineInputField".
但它们都不是“显示动画控件”。
有人知道如何获取“+”元素吗?
(奇怪的是这些元素并没有全部列在一个地方,在 ref/AppearanceElements 中)
谢谢,
最佳答案
有什么原因导致您无法使用操纵器
吗?
Manipulate[x, {{xChanged, False}, None}, {x, None},
Grid[{{"x ",
Manipulator[
Dynamic[x, (x = #; xChanged = True; #) &], {0, 1, .1}],
Spacer[2], Dynamic@x}}, Frame -> None, Spacings -> {0.2, 0.1},
Alignment -> Center]]
关于wolfram-mathematica - 如何直接添加元素 'Show Animation Control'(不使用Manipulate控件设置)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7340971/