如何使用散景服务设置自定义 CSS

Ant*_*ins 5 css python widget bokeh

css_classes如果我通过 服务我的应用程序,如何将 css 属性分配给分配给小部件的自定义类bokeh serve --show

from bokeh.models import Button
button = Button(label="Press Me", css_classes=['myclass'])
curdoc().add_root(button)
Run Code Online (Sandbox Code Playgroud)

Ant*_*ins 0

好的,我已经做到了这一点:

import os
from bokeh.plotting import curdoc
from bokeh.models import Button
from jinja2 import Environment, FileSystemLoader

button = Button(label="Press Me", css_classes=['myclass'])
z = curdoc()
env = Environment(loader=FileSystemLoader(os.getcwd()))
z.template = env.get_template('file.html')
z.add_root(button)
Run Code Online (Sandbox Code Playgroud)

但我有一种强烈的感觉,应该有比这更简单的事情。@bigreddot,你能给我一个线索吗?