MJS*_*MJS 6 python widget jupyter
我试图修改python 2.7中的jupyter标签小部件的字体属性(重量,颜色等).作为一个例子,我尝试了以下内容:
import ipywidgets as widgets
myLabel= widgets.Label(value = 'Some Label',color = '#ff0000') #change font color to red
myLabel
Run Code Online (Sandbox Code Playgroud)
当我运行这段代码时,我没有错误,但标签颜色仍然是默认的黑色.
我知道有两种方法。
text = 'Some text'
htmlWidget = widgets.HTML(value = f"<b><font color='red'>{text}</b>")
labelWidget = widgets.Label(value = r'\(\color{red} {' + text + '}\)')
Run Code Online (Sandbox Code Playgroud)
更新:现在使用 Ipyvuetify ....
import ipyvuetify as v
text = 'Some text'
v.Html(tag="div", children=[text], style_ = "color: red; font-weight: bold")
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2746 次 |
最近记录: |