kernel.core.display_trap — IPython 0.10.2 documentation

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »

# kernel.core.display_trap

## Module: `kernel.core.display_trap`

Inheritance diagram for `IPython.kernel.core.display_trap`:

Manager for replacing sys.displayhook().

## `DisplayTrap`

class `IPython.kernel.core.display_trap.` `DisplayTrap`(formatters=None, callbacks=None)

  Bases: `object`

  Object to trap and format objects passing through sys.displayhook().

  This trap maintains two lists of callables: formatters and callbacks. The formatters take the last object that has gone through since the trap was set and returns a string representation. Callbacks are executed on every object that passes through the displayhook and does not return anything.

  `__init__`()
  `add_to_message`()

    Add the formatted display of the objects to the message dictionary being returned from the interpreter to its listeners.

  `clear`()

    Reset the stored object.

  `hook`()

    This method actually implements the hook.

  `set`()

    Set the hook.

  `unset`()

    Unset the hook.

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »