Adding Alignment to a Manipulate Ouput in Mathematica

∥☆過路亽.° 提交于 2019-12-11 07:19:08

问题


Considering the following :

Manipulate[
           If[Intersection[Row1, Row2] == {}, 
              Style[Plus @@ {Plus @@ Row1, Plus @@ Row2}, Bold, 20],
              "Error"],
{{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar},
{{Row2, {2}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar}
           ]

- I would like the "3" to be centered, is it possible ?


回答1:


Manipulate has its own Alignment option. You can see if that works for you:

Manipulate[

If[Intersection[Row1,Row2]=={},Style[Plus@@{Plus@@Row1,Plus@@Row2},Bold,20],"Error"],   

{{Row1,{1}},{1,2,3,4,5},ControlType->TogglerBar},
{{Row2,{2}},{1,2,3,4,5},ControlType->TogglerBar},

Alignment->Center
]




回答2:


Use a Panel, with the Alignment option:

Manipulate[
 Panel[
  If[Intersection[Row1, Row2] == {}, 
     Style[Plus @@ {Plus @@ Row1, Plus @@ Row2}, Bold, 20], "Error"
  ], 
  ImageSize -> 150, Alignment -> Center, Appearance -> "Frameless"
 ], 
 {{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar},
 {{Row2, {2}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar}
]


来源:https://stackoverflow.com/questions/6469288/adding-alignment-to-a-manipulate-ouput-in-mathematica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!