Monospace in ipywidgets.Textarea?

不想你离开。 提交于 2020-12-15 06:23:09

问题


how could I get my widgets to use monospace fonts?

from ipywidgets import Textarea
Textarea('The world is bigger than you.')

I want to show some table style data.


回答1:


This may be a brittle solution, but it seems to work. Add a html magic section giving the css styling:

%%html
<style>
textarea, input {
    font-family: monospace;
}
</style>



回答2:


This also works:

from IPython.display import display
from IPython.core.display import HTML

display(HTML("<style>textarea, input { font-family: monospace; }</style>"))


来源:https://stackoverflow.com/questions/54471862/monospace-in-ipywidgets-textarea

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!