ipywidgets.Button 的 'icon' 参数是什么?
What is the 'icon' argument for ipywidgets.Button?
我想了解如何在 jupyter notebook 中显示按钮,但是 documentation 在这个项目上有点稀疏。
提到有一个参数'icon'。但是这是什么意思?可以使用什么值?其他地方是否隐藏了一些文档?
您可以指定 Font Awesome 4.7 目录中的图标,方法是在前面加上 fa-
。
https://fontawesome.com/v4.7.0/icons/
import ipywidgets as ipyw
ipyw.Button(
description = 'Button',
icon = 'fa-bullhorn',
)
实际上,文档表明图标是 FontAwesome names without the 'fa-' prefixname
。 see doc here:
button = widgets.Button(
description='Click me',
disabled=False,
button_style='', # 'success', 'info', 'warning', 'danger' or ''
tooltip='Click me',
icon='check' # (FontAwesome names without the `fa-` prefix)
)
button
因此,下面的代码也可以工作:
import ipywidgets as ipyw
ipyw.Button(
description = 'Button',
icon = 'bullhorn',
)
我想了解如何在 jupyter notebook 中显示按钮,但是 documentation 在这个项目上有点稀疏。
提到有一个参数'icon'。但是这是什么意思?可以使用什么值?其他地方是否隐藏了一些文档?
您可以指定 Font Awesome 4.7 目录中的图标,方法是在前面加上 fa-
。
https://fontawesome.com/v4.7.0/icons/
import ipywidgets as ipyw
ipyw.Button(
description = 'Button',
icon = 'fa-bullhorn',
)
实际上,文档表明图标是 FontAwesome names without the 'fa-' prefixname
。 see doc here:
button = widgets.Button(
description='Click me',
disabled=False,
button_style='', # 'success', 'info', 'warning', 'danger' or ''
tooltip='Click me',
icon='check' # (FontAwesome names without the `fa-` prefix)
)
button
因此,下面的代码也可以工作:
import ipywidgets as ipyw
ipyw.Button(
description = 'Button',
icon = 'bullhorn',
)