After you write down your jupyter notebook file content, if you want to show the jupyter notebook content to others like a PPT, you can read this article. In this article it will tell you how to convert a jupyter notebook file to a PPT like presentation html file.
1. Create Original Jupyter Notebook Source File.
- First start jupyter notebook in a directory and create a jupyter notebook file ( please refer How To Start Jupyter Notebook In Anaconda Python Virtual Environment ). In this example, the file name is TestSlideShow.ipynb.
- Click the TestSlideShow.ipynb file link to open and edit it. Then click the View —> Cell Toolbar —> None menu item, then you can input python source code in the jupyter notebook file.
- Click the menu Insert —> Insert Cell Above / Below to insert a cell line in the jupyter notebook file.
- Focus the cell line 1, and select Raw NBConvert item in the cell line type drop down list. And input
<h1>How To Create SlideShow From Jupyter Notebook</h1>in the first cell line.
- Insert a new cell line under above cell line, and select Code in the cell line type drop down list. And input below python code in it. Then click the Run button to generate the output under the python source code, then you can display the audio control bar in the slideshow later. Refer article How To Display Rich Output Media ( Audio, Video, Image etc) In IPython Jupyter Notebook
from IPython.display import Audio audio = Audio(filename='./test.mp3') display(audio)
- Insert more cell line after above cell line, and input below python source code to display an online image. To show the image in slideshow later, you should focus the cell line and click Run button to run the cell line source code first.
from IPython.display import Image remote_image = Image(url='http://python.org/images/python-logo.gif') display(remote_image)
- Insert another cell line under above line, and input below soruce code in it, when you run the source code, it will create a slide bar under the source code. Refer article How To Add Interactive Widget ( Slide Bar ) In Jupyter Notebook
from ipywidgets import interact @interact(x=(0, 100)) def double_number(x): print("The double of %d is %d." % (x, x*2))
2. Convert Jupyter Notebook File To SlideShow Html File.
After you create above jupyter notebook file, and run the code type cell line to generate the output, then you can convert the jupyter notebook file to a slideshow html file follow below steps.
- Click View —> Cell Toolbar —> Slideshow menu item, then it will display a Slide Type drop down list at the end of each cell line.
- There are 5 slide types in the drop down list. We will explain each slide type below.
- Slide : Home page, switch by pressing the left and right arrow keys.
- Sub-Slide : Sub page, switch by pressing the up and down arrow keys.
- Fragment : It is hidden at the beginning, and it is displayed after pressing the space bar or arrow keys to achieve dynamic effects.
- Skip : Cells not shown in the slide show.
- Notes : As the speaker’s memo notes, they are not displayed on the slides.
- You can select different slide type for each cell line to see the slide type effect. In this example, i select Slide slide type for each cell line.
- Click File —> Save and Checkpoint menu item to save the jupyter note book file.
- Then return to the jupyter notebook file list page. Click New —> Terminal menu item to open a new browser tab and enter command line console.
- Run below command in the opened terminal console.
jupyter nbconvert TestSlideShow.ipynb --to slides --post serve
- Above command will create a slideshow html file in the jupyter notebook file list, in this example the slideshow file name is TestSlideShow.slides.html.
- Click the TestSlideShow.slides.html file link to open the slide show html file, then you can see each cell line by click the arrow keys at the bottom right in the html file.