1

Is there a way to display large blocks of code in an iPython notebook in a scroll window?

I have a notebook where the focus is on graphical output of the code and comments in the markdown text. I want to be able to execute the code in the notebook and have it available to the reader, but many of the code blocks are very lengthy. A scroll window would make a notebook much cleaner and more concise, allowing readers the option of moving past large code blocks.

Thomas K
  • 39,200
  • 7
  • 84
  • 86
pjw
  • 2,133
  • 3
  • 27
  • 44
  • Neither is exactly what you ask for, but you might be interested in the [Codefolding](https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/Codefolding) and [Hide Input All](https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/Hide-Input-All) extensions. – Thomas K Feb 25 '16 at 17:02
  • Excellent suggestions. Thanks. I particularly like the firstline comment folding. – pjw Feb 26 '16 at 18:13

1 Answers1

1

The best way so far is to use the hide_code package (https://pypi.python.org/pypi/hide_code/0.1.5). To install:

$ pip install hide_code

This will enable you to hide or display the content of each individual cell. It is great !

Though I hope the vertical scroll bar for input cells will be available soon.

Boris Bolliet
  • 236
  • 3
  • 4