Comments (3)
This would be relatively easy to add, but I'm wondering about the best way to implement it. Do you think there should be a small buffer (n lines under the progress bar), or maybe fill the rest of the terminal window with the puts() statements?
from clint.
Actually, thinking about it, this would require changing progress.bar (which is currently a function) to be a class. It would have an iterable magic method similar to what it currently has, and other methods for printing to the screen, so would require a big refactor. You'd also have to do your for loops like so instead
newbar = progress.bar()
for i in newbar(range(100)):
...
I'll see if I can knock together a proof of principle.
In the mean time, you can use sys.stderr.write()
to put stuff before the progress bar;
for i in progress.bar(range(100)):
sleep(random() * 0.2)
sys.stderr.write("Progress: \t")
will yield
>>> Progess: [######## ] 27/100 - 00:00:05
but note, this will redraw on every iteration, so is likely only useful for when your iterations are slow (or few)
from clint.
I don't know, each solution is good, but it could be complicated to implement, couldn't it ?
Maybe the easiest way to implement this, we should only authorize one string without line breaks by iteration, and put the string at the right of the progress bar.
It's enough in the most cases.
Ideally, it could be wonderful to have the three solutions ;-)
from clint.
Related Issues (20)
- Colors in columns not working?
- Pypi package is outdated HOT 5
- Use proper terminal description rather than `sys.platform` to determine ANSI code support
- Boolean return values swapped for prompt.yn with default="n" HOT 2
- clint.textui.formatter.max_width: unexpected newline when using colorred_string HOT 2
- clint 0.4.1 on pypi is not actul with master repo HOT 2
- Bold attribute does not work when newline
- Problem when attempting to capture stdout in TestCase using "puts"
- Support bold (or underline) text with no color specification
- Support for custom validators
- IndexError while running unicode.py from examples
- Rename / rebrand project? HOT 3
- input() color not working
- Confusing regexp in .textui.colored.clean() HOT 3
- Default on prompt.yn returns True always HOT 1
- PyPi module update HOT 1
- Hide progress after end
- Documentation please
- comparison using is/is not with string literal rasises SyntaxWarning
- bug in progress.bar function 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 clint.