IPython Documentation

Table Of Contents

Previous topic

core.debugger

Next topic

core.display_trap

This Page

core.display

Module: core.display

Inheritance diagram for IPython.core.display:

Top-level display functions for displaying object in different formats.

Authors:

  • Brian Granger

Classes

DisplayObject

class IPython.core.display.DisplayObject(data=None, url=None, filename=None)

Bases: object

An object that wraps data to be displayed.

__init__(data=None, url=None, filename=None)

Create a display object given raw data.

When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

reload()

Reload the raw data from file or URL.

HTML

class IPython.core.display.HTML(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

__init__(data=None, url=None, filename=None)

Create a display object given raw data.

When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

reload()

Reload the raw data from file or URL.

Image

class IPython.core.display.Image(data=None, url=None, filename=None, format=u'png', embed=False)

Bases: IPython.core.display.DisplayObject

__init__(data=None, url=None, filename=None, format=u'png', embed=False)

Create a display an PNG/JPEG image given raw data.

When this object is returned by an expression or passed to the display function, it will result in the image being displayed in the frontend.

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

format : unicode

The format of the image data (png/jpeg/jpg). If a filename or URL is given for format will be inferred from the filename extension.

embed : bool

Should the image data be embedded in the notebook using a data URI (True) or be loaded using an <img> tag. Set this to True if you want the image to be viewable later with no internet connection. If a filename is given embed is always set to True.

reload()

Reload the raw data from file or URL.

JSON

class IPython.core.display.JSON(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

__init__(data=None, url=None, filename=None)

Create a display object given raw data.

When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

reload()

Reload the raw data from file or URL.

Javascript

class IPython.core.display.Javascript(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

__init__(data=None, url=None, filename=None)

Create a display object given raw data.

When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

reload()

Reload the raw data from file or URL.

Math

class IPython.core.display.Math(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

__init__(data=None, url=None, filename=None)

Create a display object given raw data.

When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

reload()

Reload the raw data from file or URL.

Pretty

class IPython.core.display.Pretty(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

__init__(data=None, url=None, filename=None)

Create a display object given raw data.

When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

reload()

Reload the raw data from file or URL.

SVG

class IPython.core.display.SVG(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

__init__(data=None, url=None, filename=None)

Create a display object given raw data.

When this object is returned by an expression or passed to the display function, it will result in the data being displayed in the frontend. The MIME type of the data should match the subclasses used, so the Png subclass should be used for ‘image/png’ data. If the data is a URL, the data will first be downloaded and then displayed. If

Parameters :

data : unicode, str or bytes

The raw data or a URL to download the data from.

url : unicode

A URL to download the data from.

filename : unicode

Path to a local file to load the data from.

data
reload()

Reload the raw data from file or URL.

Functions

IPython.core.display.clear_output(stdout=True, stderr=True, other=True)

Clear the output of the current cell receiving output.

Optionally, each of stdout/stderr or other non-stream data (e.g. anything produced by display()) can be excluded from the clear event.

By default, everything is cleared.

Parameters :

stdout : bool [default: True]

Whether to clear stdout.

stderr : bool [default: True]

Whether to clear stderr.

other : bool [default: True]

Whether to clear everything else that is not stdout/stderr (e.g. figures,images,HTML, any result of display()).

IPython.core.display.display(*objs, **kwargs)

Display a Python object in all frontends.

By default all representations will be computed and sent to the frontends. Frontends can decide which representation is used and how.

Parameters :

objs : tuple of objects

The Python objects to display.

include : list or tuple, optional

A list of format type strings (MIME types) to include in the format data dict. If this is set only the format types included in this list will be computed.

exclude : list or tuple, optional

A list of format type string (MIME types) to exclue in the format data dict. If this is set all format types will be computed, except for those included in this argument.

IPython.core.display.display_html(*objs, **kwargs)

Display the HTML representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw HTML data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]

IPython.core.display.display_javascript(*objs, **kwargs)

Display the Javascript representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw javascript data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]

IPython.core.display.display_jpeg(*objs, **kwargs)

Display the JPEG representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw JPEG data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]

IPython.core.display.display_json(*objs, **kwargs)

Display the JSON representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw json data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]

IPython.core.display.display_latex(*objs, **kwargs)

Display the LaTeX representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw latex data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]

IPython.core.display.display_png(*objs, **kwargs)

Display the PNG representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw png data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]

IPython.core.display.display_pretty(*objs, **kwargs)

Display the pretty (default) representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw text data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]

IPython.core.display.display_svg(*objs, **kwargs)

Display the SVG representation of an object.

Parameters :

objs : tuple of objects

The Python objects to display, or if raw=True raw svg data to display.

raw : bool

Are the data objects raw data or Python objects that need to be formatted before display? [default: False]