问题
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