python - 需要 Bokeh CSS 示例

标签 python css flask bokeh

我一直在尝试使用我从 gapminder 演示修改的 flask 中的 css 文件来设置 Bokeh 小部件的样式。特别是,我目前正在尝试设置下拉菜单、选项卡和 slider 小部件的样式,但进展不大。我能够使用 gapminder css 示例设置工具提示的样式,但最终想知道是否还有其他示例,或者更好的是,列出所有 Bokeh 样式选项(即 .bk-... 样式)。我不确定这是否应该正常工作,因为我仍在学习网络开发,我当前在 flask 中的 index.html 文件看起来像:

<html>
  <head>
    <link
      href="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.1.min.css"
      rel="stylesheet" type="text/css">
    <link
      href="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.1.min.css"
      rel="stylesheet" type="text/css">
    <link
      rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles/gapminder.css') }}">
    <script src="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.1.min.js"></script>
    <script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.1.min.js"></script>
    {{ script | safe }}
  </head>
  <body>
    <div class=page>
      {{ div | safe }}
    </div>
  </body>
</html>

在此先感谢您的帮助。

最佳答案

不确定您是否仍在寻找回复,但这是我为解决此问题所做的工作。

    <style>      
        {% include 'styles.css' %}
         .bk-root .bk-toolbar-right .bk-button-bar-list .bk-toolbar-button:hover .bk-tip {
        color: #5DADE2;
        }   
        .bk-root .bk-slider-parent input[type="text"]{
        color: #FDFEFE;
        }   
     </style>

这是非常手动的,因为我首先生成了 Bokeh 图,检查了我想要更改的小部件元素,然后将其简单地添加到 index.html 文件中。如果您想查看可以编辑哪些属性,只需检查它们,您就会在那里看到它们。

对于此示例,我更改了将鼠标悬停在工具名称上时的颜色以及 slider 值颜色。

我还包含了一个单独的 .css 文件,因此您可以将其全部移动到那里。

关于python - 需要 Bokeh CSS 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38780626/

相关文章:

css - 单词中出现神秘的额外字母空间

html - Font-family 是不是继承给了表单输入域?

flask 登录: TypeError: decoding Unicode is not supported

python-3.x - 运行导入的 Flask 应用程序时出现 ModuleNotFoundError

python - 带有用于上传的 Flask 的 HTML 文件夹选择器

python - 如何在没有迭代的情况下基于 Pandas 中的 2+ 个条件创建一个新的 df.column?

python - 在 Python 中创建长度为 n 的链表的更快方法

python - 去除标点符号,输出剩余文本-Python 3 Function

python - 如何获取特定日期之前所有 EBS 快照 "started"的列表?

javascript - Jquery 中 droppable 中 draggable 被 droppable 如何设置结果?