Skip to content

Instantly share code, notes, and snippets.

@sibosutd
Created October 12, 2016 07:39
Show Gist options
  • Select an option

  • Save sibosutd/c1d9ef01d38630750a1d1fe05c367eb8 to your computer and use it in GitHub Desktop.

Select an option

Save sibosutd/c1d9ef01d38630750a1d1fe05c367eb8 to your computer and use it in GitHub Desktop.
Implementation of python progress bar (or status bar) without using Progressbar library.
'''
Implementation of python progress bar (or status bar)
without using Progressbar library.
Result:
Completed: [==================================================] 100%
Created by Sibo, 12 Oct.
'''
import time
import sys
total = 1007 # total number to reach
bar_length = 30 # should be less than 100
for i in range(total+1):
percent = 100.0*i/total
sys.stdout.write('\r')
sys.stdout.write("Completed: [{:{}}] {:>3}%"
.format('='*int(percent/(100.0/bar_length)),
bar_length, int(percent)))
sys.stdout.flush()
time.sleep(0.002)
@whbruce
Copy link

whbruce commented Jun 3, 2025

Nice work.

@kasemmaster2021-glitch
Copy link

Uploading Screenshot_2025-10-14-09-27-06-64_21663e4122e364a51066cc7b847429d5.jpg…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment