Package: collpy
Add text color highlights, load bars, progress displays and style to your
python scripts and shell sessionsCollpy
GistApplicationsHighlightspecial textserrorsCreateCustom buttons or list bullet stylesProgress barsMulti-styled loading barsPercentage progress displaySpinner progress displayRandom load barDownload barUsageTo use, install package using pip$ pip3 install collpyUsing Progress barsProgress bars are used to tell how far or how long a process has gone or
taken and how much is left to be doneIt highlighs the lenght of the total procress and the time take to
completeProgress bars are best used when a user wants to iterate over a number
of values and perform actions on those values while taken note of the
average time elapsed and getting an idea of the time left for a process
to reach completion.Import package into python script or shell environmentfromcollpyimport*# or single importsfromcollpyimportLoad_bar# Using a custom load bar# The lenght indicates the size of the fullbar or the number of# single barsloadbar=Load_bar(name="Processing...",length=20,style='$')"""
The load bar can be loaded with the parameters absent
This makes the Load_bar use its default values
name = Loading...
length = 20
style = #

i.e
"""loadbar=Load_bar()# to iterate over an iterable, it is best if its length# is a multiple of the the length of the bar# For instance if we have a list of 30 items# we could doloadbar=Load_bar(length=10)# or 15 as the case may be# to iterate over the list# saylst=[iforiin<whatever>]# orstring='some long string to be worked on'# orval=100# we doforiinloadbar.iter(lst):# or string or val# do some work on iThe same method applies for the following But here, the styles are fixed
and can’t be changeddarkbar=Dark_bar()circlebar=Circle_bar()squarebar=Square_bar()Using the random barrandombar=Random_bar()# the name paramenter can be changed or left as defaultrandombar=Random_bar(name='Downloading... ')# to use, call the iter method with the iterableforiinrandom.iter(val):# do some work on (i)Using the Spinner and percentspinner=Spinner()# the name paramenter can be changed or left as defaultspinner=Spinner(name='Authenticating... ')# to use, call the iter method with the iterable# support for a next() method will be available in future versionsforiinspinner.iter(val):# do some work on (i)# the same process works for percentpercent=Percent()Support for a next() method for progress bars will be available in future versionsAdding HighlightsNote: Highlights are best used with the pring functionCreating a botton or bullet styleAvailable botton states [‘x’,’=’,’+’,’*’,’~’,’$’,’#’,’@’,’ ‘,’-‘]Available colors
[‘red’,’green’,’orange’,’blue’,’purple’,’lightblue’,’cyan’]# to add button# the ind parameter represents the index of the botton state on the list# of available botton states. Remember indexing in python starts at 0# default index is zero, default color is red# default outer is True# outer (a boolean) determines if the botton should have an outer shell# or not i.e '[x]' or 'x'but=button(ind=2,color='lightblue')message='text text text'print(but+message)Changing text color and backgroundCHANGING TEXT COLORWhen text color is to be changes, the text to be printed out should be
printed the the colpy cprint(txt=text,color=’purple’) methodThis prints out the text with the intended color# An example# for a list of values to be printed outforiinlist:cprint(txt=i,color='orange')This prints out the test in the specified colorCHANGING BACKGROUNDThe background of a text can be changes to highligh parts of texts, show
errors among other thingsAvailable colors
[‘black’,’red’,’green’,’orange’,’blue’,’purple’,’lightblue’,’cyan’]# An exampleerr='List index out of range'error=highlight(txt=err,color='red')print('IndexError: '+error+'....')Notekindly share with friends :smiley:Thank you for using :smile:If there is any problem, you can open an issue :grey_question:Leave us a star :star:Contributor(s)[@BlankGodd](https://github.com/BlankGodd)