Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning IPython for Interactive Computing and Data Visualization, Second Edition

You're reading from   Learning IPython for Interactive Computing and Data Visualization, Second Edition Get started with Python for data analysis and numerical computing in the Jupyter notebook

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781783986989
Length 200 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Cyrille Rossant Cyrille Rossant
Author Profile Icon Cyrille Rossant
Cyrille Rossant
Arrow right icon
View More author details
Toc

Customizing the Notebook interface with JavaScript


The Notebook application exposes a JavaScript API that allows for a high level of customization. In this section, we will create a new button in the Notebook toolbar to renumber the cells.

Note

The JavaScript API is not stable and not well-documented. Although the example in this section has been tested with IPython 4.0, nothing guarantees that it will work in future versions without changes.

The commented JavaScript code belows adds a new Renumber button.

In [1]: %%javascript

        // This function allows us to add buttons
        // to the Notebook toolbar.
        IPython.toolbar.add_buttons_group([
        {

            // The button's label.
            'label': 'Renumber all code cells',

            // The button's icon.
            // See a list of Font-Awesome icons here:
            // http://fortawesome.github.io/Font-Awesome/icons/
            'icon': 'fa-list-ol',

            // The callback function called when the button...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime