ipython notebook toolbar customize

后端 未结 2 1737
醉话见心
醉话见心 2021-01-07 09:51

I want to add a new toolbar button on ipython notebook. I got a good link mentioned this.

So I create a new file: ~/.ipython/profile_default/static/custom/custom.js

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-07 10:49

    If you want to:

    1. Display Menu only when open a ipython notebook.
    2. Add a Menu to hide/unhide input cells.
    3. Disable the in/out prompt each cell.

    you can following below steps:

    1. Change custom.css to disable the in/out cell prompt

       ~/.ipython/profile_default/static/custom/custom.css

      Add below content:

      .prompt{
          display: None;
      }
      
    2. Change custom.js to disable toolbar & header line by default.

       ~/.ipython/profile_default/static/custom/custom.js

      Content as below:

      code_show=true;
      function code_toggle() {
       if (code_show){
           $('div.input').hide();
       } else {
           $('div.input').show();
       }
       code_show = !code_show
      }
      $([IPython.events]).on('app_initialized.NotebookApp', function(){
          $("#view_menu").append("
    3. Toggle Inputs
    4. ") $('div#header').show() $('div#maintoolbar').hide() $('div#ipython_notebook').hide() $('span#save_widget').hide() $('span#kernel_logo_widget').hide() });
    5. Restart your notebook server to take effect.

提交回复
热议问题