Note
This documentation is for a development version of IPython. There may be significant differences from the latest stable release (1.2.1).
Various display related classes.
Authors : MinRK, gregcaporaso, dannystaple
Bases: IPython.core.display.DisplayObject
Create an audio object.
When this object is returned by an input cell or passed to the display function, it will result in Audio controls being displayed in the frontend (only works in the notebook).
Parameters: | data : numpy array, list, unicode, str or bytes
url : unicode
filename : unicode
embed : boolean
rate : integer
autoplay : bool
|
---|
Examples
# Generate a sound
import numpy as np
framerate = 44100
t = np.linspace(0,5,framerate*5)
data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t))
Audio(data,rate=framerate)
Audio("http://www.nch.com.au/acm/8k16bitpcm.wav") # From URL
Audio(url="http://www.w3schools.com/html/horse.ogg")
Audio('/path/to/sound.wav') # From file
Audio(filename='/path/to/sound.ogg')
Audio(b'RAW_WAV_DATA..) # From bytes
Audio(data=b'RAW_WAV_DATA..)
Reload the raw data from file or URL.
Bases: object
Generic class to embed an iframe in an IPython notebook
Bases: IPython.lib.display.IFrame
Class for embedding a YouTube Video in an IPython session, based on its video id.
e.g. to embed the video from https://www.youtube.com/watch?v=foo , you would do:
vid = YouTubeVideo("foo")
display(vid)
To start from 30 seconds:
vid = YouTubeVideo("abc", start=30)
display(vid)
To calculate seconds from time as hours, minutes, seconds use datetime.timedelta:
start=int(timedelta(hours=1, minutes=46, seconds=40).total_seconds())
Other parameters can be provided as documented at https://developers.google.com/youtube/player_parameters#parameter-subheader
Bases: IPython.lib.display.IFrame
Class for embedding a Vimeo video in an IPython session, based on its video id.
Bases: IPython.lib.display.IFrame
Class for embedding a Scribd document in an IPython session
Use the start_page params to specify a starting point in the document Use the view_mode params to specify display type one off scroll | slideshow | book
e.g to Display Wes’ foundational paper about PANDAS in book mode from page 3
ScribdDocument(71048089, width=800, height=400, start_page=3, view_mode=”book”)
Bases: object
Class for embedding a local file link in an IPython session, based on path
e.g. to embed a link that was generated in the IPython notebook as my/data.txt
you would do:
local_file = FileLink("my/data.txt")
display(local_file)
or in the HTML notebook, just:
FileLink("my/data.txt")
Parameters: | path : str
directory_prefix : str
result_html_prefix : str
result_html_suffix : str
|
---|
Bases: IPython.lib.display.FileLink
Class for embedding local file links in an IPython session, based on path
e.g. to embed links to files that were generated in the IPython notebook under my/data, you would do:
local_files = FileLinks("my/data")
display(local_files)
or in the HTML notebook, just:
FileLinks("my/data")
See FileLink for the path, url_prefix, result_html_prefix and result_html_suffix parameters.
Formatter functions must be of the form:
f(dirname, fnames, included_suffixes)
The function should return a list of lines that will be printed in the notebook (if passing notebook_display_formatter) or the terminal (if passing terminal_display_formatter). This function is iterated over for each directory in self.path. Default formatters are in place, can be passed here to support alternative formatting.