Showing Progress Bar

2013-11-23 Thread Himanshu Garg
I want to show simple dots while my program copies the files. I have found the code like: for i in range(10): print '.', time.sleep(1) But this will execute ten times as it is predefined and the task to copy will execute after or before this loop based on the location I have placed my

Re: Showing Progress Bar

2013-11-23 Thread Ned Batchelder
On Saturday, November 23, 2013 6:36:28 AM UTC-5, Himanshu Garg wrote: I want to show simple dots while my program copies the files. I have found the code like: for i in range(10): print '.', time.sleep(1) But this will execute ten times as it is predefined and the task to copy

Re: Showing Progress Bar

2013-11-23 Thread Himanshu Garg
for i in range(10): sys.stdout.write(.) sys.stdout.flush() time.sleep(1) sys.stdout.write(\n) shutil.copytree(pack, /lxc/pack) But Here, the loop will first print the progress dots and then it will copy the directory. But I want that these two tasks should run

Re: Showing Progress Bar

2013-11-23 Thread Frank Millman
Himanshu Garg hgarg.in...@gmail.com wrote in message news:b4b7cf70-07fa-455a-b01f-cb69b9402...@googlegroups.com... I want to show simple dots while my program copies the files. I have found the code like: for i in range(10): print '.', time.sleep(1) But this will execute ten times

Re: Showing Progress Bar

2013-11-23 Thread Himanshu Garg
Thanks a lot Frank! Its superb. I got what I wanted. Thanks Again! -- https://mail.python.org/mailman/listinfo/python-list

Re: Showing Progress Bar

2013-11-23 Thread Chris Angelico
On Sat, Nov 23, 2013 at 11:11 PM, Frank Millman fr...@chagford.com wrote: class ProgressBar(threading.Thread): In a separate thread, print dots to the screen until terminated. It's worth noting that this, as coded, is not a progress bar but merely an activity bar. The number of