改变python bokeh的颜色PreText()

问题描述 投票:1回答:1

有没有办法改变字体或颜色

bokeh.models.widgets.markups.PreText

from bokeh.models.widgets import PreText
from bokeh.plotting import show

mytext = PreText()
mytext.text = "Text in black"
show(mytext)
python bokeh
1个回答
1
投票

散景标记映射到HTML元素,因此您可以通过关键字style将样式绑定到它。像这样:

mytext = PreText(text="Text in black", style={'color': 'black'})

另请注意,PreText映射到<pre>标记,该标记用于预格式化文本,通常用于显示代码。根据您想要显示的内容,段落更合适。

您可以检查documentation here以及使用散景和应用风格的similar question

© www.soinside.com 2019 - 2024. All rights reserved.