假设我在 Jupyter Notebook 的单元格中有以下代码:
from ipywidgets.widgets import HBox, Text
from IPython.display import display
text1 = Text(description = "text1", width = 100)
text2 = Text(description = "text2", width = 100)
text3 = Text(description = "text3", width = 100)
text4 = Text(description = "text4", width = 100)
text5 = Text(description = "text5", width = 100)
display(HBox((text1, text2, text3, text4, text5)))
它产生以下输出:
如您所见,Text 对象之间存在大量不必要的间距。如何更改间距以使它们留在单元格内?