Command Line Progress Bar
msirenef at lightbird.net
Wed Dec 26 07:33:40 CET 2012
On 12/26/2012 01:17 AM, Kevin Anthony wrote:
> I'm writing a file processing script(Linux), and i would like to have
> a progress bar. But i would also like to be able to print messages.
> Is there a simple way of doing this without implementing something
> like ncurses?
> Kevin Anthony
> www.NoSideRacing.com <http://www.NoSideRacing.com>
Sure, you just need to print messages then the progress bar, without
printing newline, then
sys.stdout.flush(), then in the next loop start by printing '\r' to
erase the progress bar.
That is, if you want messages to scroll up. You can also use half a line
for the progress
bar and the other half for a short message, then you print both with
and erase both with '\r'.
Lark's Tongue Guide to Python: http://lightbird.net/larks/
More information about the Python-list