##// END OF EJS Templates
Adding clear_output to kernel and HTML notebook.
Adding clear_output to kernel and HTML notebook.

File last commit:

r5080:bdf1ecd4
r5080:bdf1ecd4
Show More
clear_output.ipynb
55 lines | 2.1 KiB | text/plain | TextLexer

A demonstration of the ability to clear the output of a cell during execution.

In [8]:
from IPython.core.display import clear_output, display
In [4]:
import time

First we show how this works with display:

In [17]:
for i in range(10):
    display("Time step: %i" % i)
    time.sleep(0.5)
    clear_output()

Next, we show that clear_output can also be used to create a primitive form of animation using matplotlib:

In [20]:
for i in range(10):
    figure()
    plot(rand(100))
    show()
    time.sleep(0.1)
    clear_output()