gpt4 book ai didi

python-3.x - 调整 Bokeh 下拉菜单和其他小部件的大小

转载 作者:行者123 更新时间:2023-12-03 23:56:15 24 4
gpt4 key购买 nike

如何在 Python 中使用 Bokeh 调整下拉列表或其他小部件的大小?

我有以下下拉列表作为图形的过滤器:

enter image description here

如您所见,它们的长度各不相同。它们在这样的小部件框中:

widgets = widgetbox([school_selector,
degree_selector,
student_selector,
began_exam_selector,
finished_exam_selector],
sizing_mode='fixed')

它会被放入最终的布局中,如下所示:
dashboard_layout = column(widgets, column(time_v_note, exam_data_table))
curdoc().add_root(dashboard_layout)

我试过 'fixed' , 'scale_width' , 和 'stretch_both'作为 sizing_mode 的选项但什么都没有改变。我只希望所有过滤器的尺寸相同,这样就没有锯齿状边缘。

谢谢

编辑:

Select() 结构如下所示:
#### School Selector
## Selection Options
school_select_opts = ['All'] + list(exam_df['School ID - School Name'].unique())

## Selector Build
school_selector = Select(title='1) Choose a School:',
options=school_select_opts,
value='All')

#### Degree Selector
## Selection Options
degree_select_opts = ['All'] + list(exam_df['Degree'].unique())

## Selector Build
degree_selector = Select(title='2) Choose a Degree:',
options=degree_select_opts,
value='All')

#### Exam Selector
## Selection Options
exam_select_opts = ['All'] + list(exam_df['Exam ID - Exam Name'].unique())

## Selector Build
exam_selector = Select(title='3) Choose an Exam:',
options=exam_select_opts,
value='All')

#### Student Selector
## Selection Options
student_select_opts = ['All'] + list(exam_df['Applicant ID - Full Name'].unique())

## Selector Build
student_selector = Select(title='4) Choose a Student:',
options=student_select_opts,
value='All')

#### Begin Exam Selector
## Selection Options
begin_exam_opts = ['All', 'Yes', 'No']

## Selector Build
began_exam_selector = Select(title='Began Exam?',
options=begin_exam_opts,
value='All')

#### Finished Exam Selector
## Selection Options
finished_exam_opts = ['All', 'Yes', 'No']

## Selector Build
finished_exam_selector = Select(title='Finished Exam?',
options=finished_exam_opts,
value='All')

最佳答案

只需记下宽度并提及它的值(value),您就会得到所需的答案。

代码 :

menu = [("Delhi", "3"), ("Mumbai", "4"), ("Chennai", "4"), ("Kochi", "6"), ("Kolkata", "7")]

dropdown = Dropdown(label="LOCATION", button_type="success", menu=menu,width=120)

关于python-3.x - 调整 Bokeh 下拉菜单和其他小部件的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46596701/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com