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

Michael Droettboom mdroe at stsci.edu
Wed Apr 25 13:21:45 EDT 2012


I've hacked the fixConsole stuff in the JavaScript to mangle the text 
based on the "\r" in it.  This seems to work quite well, but I can't get 
the saving/restoring of notebooks to work correctly.  I have a pull 
request here:

https://github.com/ipython/ipython/pull/1659

Mike

On 04/25/2012 11:11 AM, Michael Droettboom wrote:
> That's helpful.  What I'm hoping to get to work in progress bars
> interspersed without other logging all in the same output chunk -- and
> with an API that makes sense and works either inside IPython notebook or
> out.  The ability to send down custom HTML and Javascript (which I
> didn't know about) may bear some fruit... will have experiment and think
> on that.
>
> Thanks,
> Mike
>
> On 04/23/2012 12:06 AM, Fernando Perez wrote:
>> Hi Mike,
>>
>> On Wed, Apr 11, 2012 at 9:43 AM, Michael Droettboom<mdroe at stsci.edu>   wrote:
>>> 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?
>> Have you had a chance to look at the new Animations_and_Progress
>> notebook in master?  It shows examples of how to make both text-based
>> and graphical progressbars in the nb.
>>
>> I hope that helps, and sorry for the delayed reply!
>>
>> Best,
>>
>> f
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list