Skip to content
/ Loading Public

an easy and fully customizable way to do loading bar in cli

License

Notifications You must be signed in to change notification settings

eupone/Loading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

this source-code is under Apache License 2.0 , read LICENSE for more information

Loading

easy loading bar !

loading is a way to do loading bar in python

  • fully customizable
  • easy to use

how to use :

bar = Bar(100)
for i in range(1000):
    bar.update(message=i)

example :

loading = Bar(100,lenght=50,time=True)
for yeet in range(100):
    if loading.update(message=yeet,time=(100-yeet) ):
        time.sleep(1)
    else:
        break

explication :

when you init the Bar , the first args is the number of iterations so if you do Bar(1000) you have to do 1000 iteration for finish the bar

for make the bar iterate , use .update

class utility required argument return
Bar init the bar total (number of iteration) Bar instance
fonction utility required argument return
update iterate the Bar None bool

kwarg :

for Bar

kwarg utility default argument
lenght the lenght of the bar 100
time if you want to show a timer False
progress the progresse of the bar 0
start_char the first char of the bar "["
start_middle_char the middle char "="
white_char the whitespace char " " (a whitespace)
end_middle_char usualy the cursor ">"
end_char the last char "]"

for update

kwarg utility default argument
message like the advancement of the loading (or like log) None
time you have to active time setting when init the bar define the remaning time 0 (give it in second)

Installation

download bar.py and import it in your project (check that it is in the right path) ex :

from bar import Bar

tested on :

  • windows 10
  • debian 9
  • ubuntu 18.04

with python 3.9.2

todo :

  • fully customizable
  • crusade the bugs
  • more things ?
  • drinking a coffee
  • eat
  • sleep

About

an easy and fully customizable way to do loading bar in cli

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages