Jupyter Notebook: enable vertical scrolling in code block

荒凉一梦 提交于 2019-12-12 10:45:17

问题


How do I enable vertical scrolling in a code block in a jupyter notebook?

I've done it accidentally before, but now I can't reproduce it. What I found was set autoscroll = true in the file itself using a text editor...

However, I did that... and it already has a setting, "scrolled": true. In the notebook, it has only horizontal scrolling, so I guess that is what the "scrolled" setting modified.


回答1:


In order to enable vertical scrolling in an output cell of the notebook, you just need to click to the left of the cell content (in the margin, you will see the area becomes slighty shaded when you are over it).

If you double click, the content of output cell will be hidden.

If you would like to hide the content of an input cell, see also Scroll windows for code in iPython (Jupyter) Notebooks?.




回答2:


As suggested by @Mandy, to turn on horizontal scrolling in Jupyter code window just go to Cell>Current/All Outputs>Toggle Scrolling




回答3:


You can try Cell -> Current Outputs -> Toggle Scrolling in the Jupyter UI to enable the scrolling for the output of one cell.




回答4:


Run this code at the end of yours:

from IPython.display import display, HTML
js = "<script>$('.output_scroll').removeClass('output_scroll')</script>"
display(HTML(js))


来源:https://stackoverflow.com/questions/35528650/jupyter-notebook-enable-vertical-scrolling-in-code-block

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