[IPython-dev] clear_output() of only last line?

Michael Droettboom mdroe@stsci....
Wed Apr 11 11:43:17 CDT 2012


I'm working on getting our animated progressbars in astropy to work in 
the IPython notebook.  I found the recipe of using "clear_output()" in 
this bug report:

https://github.com/ipython/ipython/issues/1527

That gets things closer, but unlike "\r" at a standard terminal, 
clear_output() clears the entire output chunk, not just the last line.  
So if we have multiple progress bars, or progress bars interspersed with 
logging messages, all but the last progress bar gets deleted.

For example:

from IPython.core.display import clear_output

print "Working"
for i in range(80):
     clear_output()
     print "\r" + ("=" * i)

Any suggestions?

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20120411/8b407e1b/attachment.html 


More information about the IPython-dev mailing list