Pergunta

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?

Foi útil?

Solução

  1. If it doesn't already exist, create a file named custom.js in /Users/YOURUSERNAME/.ipython/profile_default/static/custom/
    (You may have to run ipython profile create, if you have never run this command.)

  2. In custom.js, put the following lines of JavaScript

    $([IPython.events]).on("app_initialized.NotebookApp", function () {
        $('div#header').hide();
    });
    
  3. 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();
    });
    

Outras dicas

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:

  1. update your C:\Anaconda3\Lib\site-packages\notebook\static\custom\custom.css

    .container{ width:100% !important; }
    div#site{ height: 100% !important; }
    
  2. update your C:\Anaconda3\Lib\site-packages\notebook\static\custom\custom.js, and we add a shortcut ctrl+ 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;
        });
    });
    
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top