- Notifications
You must be signed in to change notification settings - Fork149
💫 Beautiful spinners for terminal, IPython and Jupyter
License
manrajgrover/halo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Beautiful spinners for terminal, IPython and Jupyter
$ pip install halo
fromhaloimportHalospinner=Halo(text='Loading',spinner='dots')spinner.start()# Run time consuming work here# You can also change properties for spinner as and when you wantspinner.stop()
Alternatively, you can use halo with Python'swith
statement:
fromhaloimportHalowithHalo(text='Loading',spinner='dots'):# Run time consuming work here
Finally, you can use halo as a decorator:
fromhaloimportHalo@Halo(text='Loading',spinner='dots')deflong_running_function():# Run time consuming work herepasslong_running_function()
Type:str
Text shown along with spinner.
Type:str
Values:grey
,red
,green
,yellow
,blue
,magenta
,cyan
,white
Color of the spinner text. Defaults toNone
.
Type:str|dict
If string, it should be one of the spinners listed in the givenjson file. If a dict is passed, it should defineinterval
andframes
. Something like:
{'interval':100,'frames': ['-','+','*','+','-']}
Defaults todots
spinner. For Windows users, it defaults toline
spinner.
Type:str
Values:bounce
,marquee
Animation to apply to the text if it's too large and doesn't fit in the terminal. If no animation is defined, the text will be ellipsed.
Type:str
Values:left
,right
Which side of the text the spinner should be displayed. Defaults toleft
Type:str
Values:grey
,red
,green
,yellow
,blue
,magenta
,cyan
,white
Color of the spinner. Defaults tocyan
.
Type:float
Interval between each frame. Defaults to spinner interval (recommended).
Type:file
Stream to write the output. Defaults tosys.stdout
.
Type:bool
Enable or disable the spinner. Defaults toTrue
.
Following are the methods available:
Starts the spinner. Iftext
is passed, it is set as spinner text. Returns the instance.
Stops and clears the spinner. Returns the instance.
Clears the spinner. Returns the instance.
Manually renders a new frame. Returns the instance.
Returns next frame to be rendered.
Stops the spinner and changes symbol to✔
. If text is provided, it is persisted else current text is persisted. Returns the instance.
Stops the spinner and changes symbol to✖
. If text is provided, it is persisted else current text is persisted. Returns the instance.
Stops the spinner and changes symbol to⚠
. If text is provided, it is persisted else current text is persisted. Returns the instance.
Stops the spinner and changes symbol toℹ
. If text is provided, it is persisted else current text is persisted. Returns the instance.
Stops the spinner and changes symbol and text. Returns the instance.
Type:str
Symbol to replace the spinner with. Defaults to' '
.
Type:str
Text to be persisted. Defaults to instance text.
Change the text of spinner.
Change the color of spinner
Change the spinner itself.
Enable or disable the spinner.
Please seeContributing guidelines for more information.
🌟 this repo to show support. Let me know you liked it onTwitter.Also, share theproject.
- py-spinners - Spinners in Python
- py-log-symbols - Log Symbols in Python
- ora - Elegant terminal spinners in JavaScript (inspiration behind this project)
MIT © Manraj Singh