Package: revolution
revolutionAn assortment of spinners to use while your Python programs run.InstallationIn order to installrevolution, run the following in your command line:pip install revolutionUsageIn order to userevolutionin your code, importing it is as simple as:fromrevolutionimportRevolutionFunction decoratorrevolutioncan be used as afunction decorator:importtimefromrevolutionimportRevolution@Revolutiondefdo_something():for_inrange(10):time.sleep(0.1)do_something()You can also provide it a description while you wait for your task to finish:importtimefromrevolutionimportRevolution@Revolution(desc='Just passing time...')defdo_something():for_inrange(10):time.sleep(0.1)do_something()with statementAnother possible way to implementrevolutionis through the use of awithstatement:importtimefromrevolutionimportRevolutionwithRevolution(desc='Running through numbers')asrev:for_inrange(100):time.sleep(0.1)rev.update(1)You can also include a visual counter by including a total:importtimefromrevolutionimportRevolutionwithRevolution(desc='Counting up to 100',total=100)asrev:for_inrange(100):time.sleep(0.1)rev.update(1)for loopIf you give a Revolution object arange objector alist, you can then iterate over it:importtimefromrevolutionimportRevolutiontotal=0foriinRevolution(range(100)):total+=itime.sleep(0.1)print(total)ManualFinally, you can userevolutionby manually controlling when to stop it:fromrevolutionimportRevolutionrev=Revolution(desc='Doing things...')rev.start()# ...rev.stop()ParametersThese are the available parameters for initializing a Revolution object:Revolution(func=None,desc='',total=None,style='',color='blue',success=None,safe=True,interval=None)funcMore infofunc: list or range, optionalIf this is a list or range object, it will iterate over each of the elements and return them one by one.Thefuncparameter should be left blank unless you initialize a Revolution object with a range object or a list.descMore infodesc: str, optionalA string to use in place of the text that displays beside the spinner.totalMore infototal: int, optionalAn integer that indicates the total number of expected iterations.styleMore infostyle: str, optionalA string that indicates which spinner style to use. If style is None or if it doesn't exist, the classic style will be used.Available options can be viewed by runningrevolution --exampleorrevolution -ein your console.colorMore infocolor: str, optionalA string that indicates which color should be used for the spinner. If a color is not provided, the color will default to 'blue'.Available options:
*black*red*green*yellow*blue*violet*cyan*whitesuccessMore infosuccess: str, optionalA string that will be displayed beside the spinner when the spinner animation stops.safeMore infosafe: bool, optionalIf True (default), spinners on Windows machines will always use the 'classic' style (even if a different style is provided).If you are using a certain spinner style and are unsure as to how it will appear on Windows machines, it is recommended that you leavesafeset to its default value.intervalMore infointerval: float, optionalA float value that is used to indicate the refresh rate of the entire spinner.StylesThere are multiple built-in spinner styles that you can take advantage of.However, only the classic spinner will be used onWindows machinesunless you setsafe=Falsewhen you initialize a Revolution object.classicRevolution(style='classic')Windows-friendlyIf a Revolution object doesn't contain a specified style, this is the style that it will default todotsRevolution(style='dots')Windows-friendlyequalRevolution(style='equal')Windows-friendlybrailleRevolution(style='braille')braille_longRevolution(style='braille_long')braille_crawlRevolution(style='braille_crawl')braille_bounceRevolution(style='braille_bounce')arcRevolution(style='arc')clear_quadrantsRevolution(style='clear_quadrants')