I want to save some space for my 14 inch screen. What should I write in e.g. ipython_notebook_config.py to trigger this?
3 Answers
If it doesn't already exist, create a file named
custom.js
in/Users/YOURUSERNAME/.ipython/profile_default/static/custom/
(You may have to runipython profile create
, if you have never run this command.)In
custom.js
, put the following lines of JavaScript$([IPython.events]).on("app_initialized.NotebookApp", function () { $('div#header').hide(); });
If you would like to also hide the toolbar by default, use these lines of JavaScript instead
$([IPython.events]).on("app_initialized.NotebookApp", function () { $('div#header').hide(); $('div#maintoolbar').hide(); });

- 1,110
- 10
- 7
-
2For Ipython3 use "$('div#header-container').hide();" instead of "$('div#header').hide();" – user5061 Apr 20 '15 at 15:05
-
You can also add a [keyboard shortcut to toggle the header, menu and toolbar](http://stackoverflow.com/questions/28876235/ipython-notebook-3-hide-headers-by-default?lq=1) – joelostblom Sep 21 '15 at 13:04
If you have a recent IPython, like v3.0.0 or higher, and are seeing only sporadic success with this method, you'll need to hook into the RequireJS dependency loader, and put the following in your common.js
:
require(['jquery'], function($) {
$('#header-container').hide();
});
common.js
is loaded at the bottom of the page, so there's no need to wait for the DOM ready event, i.e., $(function() { ... })
.
For further discussion see my answer at Turn off auto-closing parentheses in ipython and its comments.
if you are using Anaconda3
, please do:
update your
C:\Anaconda3\Lib\site-packages\notebook\static\custom\custom.css
.container{ width:100% !important; } div#site{ height: 100% !important; }
update your
C:\Anaconda3\Lib\site-packages\notebook\static\custom\custom.js
, and we add a shortcutctrl+
for toggle the header$([IPython.events]).on('notebook_loaded.Notebook',function(){ $('#header').hide(); IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-`',function (event) { if (IPython.notebook.mode == 'command') { $('#header').toggle(); return false; } return true; }); });