我似乎无法获得用于包装文本的小部件。
此代码:
import ipywidgets as widgets
test_layout = widgets.Layout(
border='1px solid black',
flex_flow = 'row wrap',
width = '200px')
test_string = 'test test test test test test test test test test'
test_label = widgets.Label(value = test_string, layout=test_layout)
test_label
输出:
我想念的是什么?我尝试了很多不同的方法,但是没有一个起作用!
我有同样的问题。我改用了HTML小部件,如下所示:
import ipywidgets as widgets
widget = widgets.HTML(value= '<style>p{word-wrap: break-word}</style> <p>'+ [variable containing long text goes here] +' </p>')