散景小部件:自定义CSS [英] bokeh widget: custom css

查看:76
本文介绍了散景小部件:自定义CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在bokeh中制作小部件时,是否可以提供自定义CSS?例如:

Is there any way to provide a custom CSS when making widgets in bokeh? E.g.:

        country_picker = widgets.MultiSelect(value=[],
                              title='country',
                              options=list(self.df['country_code'].unique()) + ['All'],
                              width=180,
                              height=120,
                              css=""".bk-layout-scale_height .bk  widget-form-input {
                                      height: 180px !important;} 
                              """)

我有一个特殊的多重选择器,具有60多个选项,因此我想提高它.虽然我想将其他多选器保持较小.

I have one particular multi-selector that has 60+ options, so I'd like to make it high. While I'd like to keep other multi-selectors small.

推荐答案

专门针对MultiSelect小部件,您可以使用

Specifically for MultiSelect widgets, you can set the number of visible items with MultiSelect.size instead of using custom css:

from bokeh.io import show
from bokeh.layouts import widgetbox
from bokeh.models.widgets import MultiSelect

multi_select = MultiSelect(title="Option:", value=["foo", "qx"],
                           options=[("foo", "Foo"), ("bar", "BAR"), ("baz", "bAz"),
                                    ("qx", "Qx"), ("hid1", "Hid1"), ("hid2", "Hid2")])
multi_select.size=6
show(widgetbox(multi_select))

这篇关于散景小部件:自定义CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆