On 12/26/2012 03: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>

Do you use Banshee?
Download the Community Extensions:
http://banshee.fm/download/extensions/


I use this tecnique to make a progress bar in the console.
You just need to understand, that a progress bar is a cross-multiplication http://en.wikipedia.org/wiki/Cross-multiplication.

import sys, time

def progressbar(value, total):
    maspro = (100*value) / total
    sys.stdout.write('\r[%s]%d%%' % ('#'*(maspro/10), maspro))
    sys.stdout.flush()

for a in range(1, 1000):
    progressbar(a, 100)
    time.sleep(2)


You can't combine your progress bar with threading module



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to