Comments (7)
How about this way? I think it can do what you want.
with Halo(spinner='dots') as spinner:
for f in files_to_load():
spinner.text = 'Loading {}'.format(f)
do_load_file(f)
from halo.
This isn't a bad solution, however, it doesn't work if there is nothing like a filename to show and I still want the spinner to be updated once a loop.
from halo.
@steelman Thanks for opening this. Could you add an example to your second comment?
from halo.
Tough question. Nothing in particular comes to my mind, so let my try theoretic cases.
- Very long labels which don't hold usable information for users (e.g. cryptographic keys)
- An unsorted or infinite set of data (so users can't determine progress)
- An event loop or waiting for a network connection to be established.
from halo.
@steelman I'm getting what you're saying. See, this is what spinner.text
is for. If we need to step in every iteration, let's say for percentage, we would need to know the length of the iterable. For that, we need to add a wrapper which handles iterations and updates the text. But we can only do it for iterables.
from halo.
At this moment halo satisfies my needs so, most probably, I won't develop any solution to the problem I described. However, I imagine, you may want to keep this issue open, so if anybody comes looking for an inspiration for a contribution, they will find one.
from halo.
Happy to update #132 and check it still works, if the feature might still be of interest @manrajgrover?
from halo.
Related Issues (20)
- Bug: halo's output doesn't persist as expected inside Jupter Lab
- spinner overwritten in Jupyter on Windows
- Can't get Unicode characters to show on Windows using Windows Terminal HOT 1
- Suggestion: allow spinners to be indented HOT 1
- Bug: Colorama init causes all ansi codes to be stripped when not in a tty HOT 2
- Suggestion: Added PEP 484 type hints
- Suggestion: Allow text to change when using decorate pattern. HOT 1
- threading.Thread.setDaemon has been deprecated in favor of setting daemon attribute directly in Python 3.10 HOT 1
- Bug: Crash when using an animation and switching to a new animated message shorter than current position
- How to integrate with logging HOT 2
- Question[Discussion]: More maintainers? HOT 1
- feature request: any appetite for supporting dynamic text? HOT 2
- Spinner does not animate during some external function call. HOT 1
- spinner not showing
- Interview partners for research about communication in GitHub projects wanted
- Suggestion: Close widget box when clearing the spinner on jupyter notebook
- Bug: halo not showing properly in Jenkins CI HOT 1
- Suggestion: show GIF demo of the various spinners
- BUG: Halo.__init__.<locals>.clean_up() takes 0 positional arguments but 1 was given HOT 1
- is_supported is always False on Windows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from halo.