IPython Documentation

Table Of Contents

Previous topic

Module: lib.demo

Next topic

Module: lib.guisupport

This Page

Module: lib.display

Various display related classes.

Authors : MinRK, gregcaporaso, dannystaple

3 Classes

class IPython.lib.display.YouTubeVideo(id, width=400, height=300, **kwargs)

Bases: object

Class for embedding a YouTube Video in an IPython session, based on its video id.

e.g. to embed the video on this page:

http://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: 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

__init__(id, width=400, height=300, **kwargs)

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”)

__init__(path, url_prefix='files/', result_html_prefix='', result_html_suffix='<br>')

path : path to the file or directory that should be formatted directory_prefix : prefix to be prepended to all files to form a

working link [default: ‘files’]
result_html_prefix : text to append to beginning to link
[default: none]
result_html_suffix : text to append at the end of link
[default: ‘<br>’]

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”)

__init__(path, url_prefix='files/', included_suffixes=None, result_html_prefix='', result_html_suffix='<br>', notebook_display_formatter=None, terminal_display_formatter=None)
included_suffixes : list of filename suffixes to include when
formatting output [default: include all files]
See the FileLink (baseclass of LocalDirectory) docstring for
information on additional parameters.
notebook_display_formatter : func used to format links for display
in the notebook. See discussion of formatter function below.
terminal_display_formatter : func used to format links for display
in the terminal. See discussion of formatter function below.