IPython / Jupyter Align Widgets

时间:2015-03-16 21:03:08

标签: widget alignment ipython jupyter

我一直在使用Jupyter小部件,并且我在对齐方面遇到问题,例如,我有下一个小部件:

from IPython.html import widgets as wdg

#Two Sliders
s1 = wdg.IntSlider(min=0,max=100,value=25,description='Xo')
s2 = wdg.IntSlider(min=0,max=100,value=25,description='Yo')

#Three Float Text 
c1 = wdg.BoundedFloatText(min=0,max=100,value=5,description='C1 ')
c2 = wdg.BoundedFloatText(min=0,max=100,value=5,description='C2 ')
c3 = wdg.BoundedFloatText(min=0,max=100,value=5,description='C3 ')

#Two Checkbox
ch1 = wdg.Checkbox(description='Check me 1')
ch2 = wdg.Checkbox(description='Check me 2')

#Containers
Con1 = wdg.HBox(children=[s1,s2])
Con2 = wdg.HBox(children=[c1,c2,c3])
Con3 = wdg.HBox(children=[ch1,ch2])
Con5 = wdg.Box(children=[Con1,Con2,Con3])
Con5c1c2c3的输出中的

都是浮动框之间没有空格,因此它们的描述重叠,我该怎么办?把它们居中,或者至少增加它们之间的空间?

1 个答案:

答案 0 :(得分:2)

我确认了'保证金'垂直和水平影响间距。

c1.margin=20
c2.margin=20
c3.margin=20