{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Basic display objects" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from IPython.display import display, Image, HTML, Javascript" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Try using the basic display classes in a notebook:\n", "\n", "* Find an image on the internet and display it in a notebook using the `Image` class. You can either save the image in the notebook's directory or load it by its URL.\n", "* Use the `HTML` class and the `%%html` cell magic to display a snippet of HTML.\n", "* Use the `JavaScript` class and the `%%javascript` cell magic to run a snippet of JavaScript.\n", "* Try displaying these objects by both returning them from an expression and by passing them to `display`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## SoundCloud" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Go to [SoundCloud](http://soundcloud.com) and search for a sound clip you want to embed in your notebook. To find the HTML code to embed the sound, click on the \"Share\" link and copy the \"Embed\" URL. Paste it into a cell using the `%%html` magic." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%load soln/soundcloud.ipy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Rich output on nbviewer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Rich output is also supported on http://nbviewer.ipython.org. To test this create a new notebook that has different types of rich output:\n", "\n", "* HTML\n", "* JPEG/PNG (use matplotlib)\n", "* JavaScript\n", "* LaTeX\n", "\n", "After creating this notebook, upload it to http://gist.github.com and then view the notebook on http://nbviewer.ipython.org." ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 0 }