Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Command Line Progress Bar

Reply
Thread Tools

Re: Command Line Progress Bar

 
 
Mitya Sirenef
Guest
Posts: n/a
 
      12-26-2012
On 12/26/2012 01:17 AM, Kevin Anthony wrote:
> Hello,
> 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?
>
> --
> Thanks
> 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
sys.stdout.flush()
and erase both with '\r'.

- mitya


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Command Line Progress Bar Oscar Benjamin Python 0 12-27-2012 07:36 PM
Re: Command Line Progress Bar xDog Walker Python 0 12-26-2012 05:39 PM
Re: Command Line Progress Bar Irmen de Jong Python 1 12-26-2012 04:19 PM
Progress bar to show the progress of a task Charlie Zhang Java 3 08-16-2004 05:53 PM
progress bar or guage bar Rob ASP General 6 07-12-2003 09:46 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57