jupyter 改注释字体,在jupyter笔记本标签小部件中更改字体属性

I am trying to modify the font attributes (weight, color, etc) of a jupyter label widget in python 2.7. As an example, I have tried the following:

import ipywidgets as widgets

myLabel= widgets.Label(value = 'Some Label',color = '#ff0000') #change font color to red

myLabel

When I run this bit of code, I get no errors, however the label color remains the default black.

解决方案

There are 2 methods that I know of.

HTML widget

Label widget with latex

text = 'Some text'

htmlWidget = widgets.HTML(value = f"{text}")

labelWidget = widgets.Label(value = r'\(\color{red} {' + text + '}\)')

1c72f24ba92c8c54267e735fc73d18b3.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值