【发布时间】:2018-05-13 15:38:37
【问题描述】:
我正在寻找 Bokeh 问题的解决方法。 当您将按钮和文本输入连续放置时,它们将不对齐。之所以会出现这种效果,是因为文本输入有一个标签,并在此处描述:https://github.com/bokeh/bokeh/issues/4817
screenshot of messed up alignment
示例代码:
# hello.py
from bokeh.io import curdoc
from bokeh.layouts import column, row
from bokeh.models.widgets import TextInput, Button, Paragraph
# create some widgets
button = Button(label="Say HI")
input = TextInput(value="Bokeh")
output = Paragraph()
# add a callback to a widget
def update():
output.text = "Hello, " + input.value
button.on_click(update)
# create a layout for everything
#layout = VBox(children=[HBox(children=[button, input]), output])
layout = column(row(button, input), output)
# add the layout to curdoc
curdoc().add_root(layout)
【问题讨论】:
标签: python button row bokeh textinput