Reputation: 49
Is there any way how I could set the minimum height for the output cell in Jupyter?
I am experiencing flicking display issues when clearing my output with clear_output(wait=True)
. When clear_output() executes, it clears the output cell so that the cell collapses down to a single line (1 row). If you output multiple lines too fast, it results in a flicker: the output cell collapses down to 1 line after clearing and then expands to multiple line as you do multiple print()
calls in a row.
I expect that if I set the minimum height for the output cell, this will eliminate the flicker as it will effectively prevent the output cell to collapse down to single line upon calling clear_output(wait=True)
.
I thought this might help, but it didn't.
from IPython.core.display import display, HTML
display(HTML("<style>.container { min-height:100em !important; }</style>"))
Thank you in advance.
Upvotes: 0
Views: 763
Reputation: 14462
I am not sure whether I understand what you are trying to achieve but container
is most probably not the class that you want to modify.
Each cell consists of input and output where output is rendered only when there is something to render and this is decided on the fly when you run the code in the input section.
So, do you want to set maximum height to only those outputs that have something in them or to all outputs even if there is nothing to be shown?
In case you care only about the outputs where there is something to be shown then you set min-height
on .output_area
class.
CSS = ".output_area { min-height: 10em; }"
HTML('<style>{}</style>'.format(CSS))
If you want to force all outputs to have min-height
, even those that would otherwise be hidden, you can set it on .output_wrapper
instead.
CSS = ".output_wrapper { min-height: 10em; }"
HTML('<style>{}</style>'.format(CSS))
Upvotes: 1