散景布局与按钮的垂直对齐 [英] bokeh layout vertical alignment with buttons

查看:68
本文介绍了散景布局与按钮的垂直对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找Bokeh中问题的解决方法. 当您连续放置一个按钮和一个文本输入时,它们将不会被忽略.发生这种效果是因为文本输入带有标签,并在此处进行了描述: https://github.com/bokeh/bokeh/issues/4817

I am looking for a workaround to an issue in Bokeh. When you put a button and a text input in a row- they will be un-alighned. This effect happens because the text input has a label and is described here: https://github.com/bokeh/bokeh/issues/4817

对齐错误的屏幕截图

示例代码:

# 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)

推荐答案

设置TextInputcss_classes属性:

input = TextInput(value="Bokeh", css_classes=["hide-label"])

如果您的应用程序是文件夹,请在