Comments (14)
It could be due to an old version but there's not really a mistake (in my case at least).
10% (1 of 10) |## | Elapsed Time: 0:00:00 ETA: 0:00:00
20% (2 of 10) |##### | Elapsed Time: 0:00:00 ETA: 0:00:00
30% (3 of 10) |######## | Elapsed Time: 0:00:00 ETA: 0:00:00
40% (4 of 10) |########### | Elapsed Time: 0:00:00 ETA: 0:00:00
50% (5 of 10) |############## | Elapsed Time: 0:00:00 ETA: 0:00:00
60% (6 of 10) |################ | Elapsed Time: 0:00:00 ETA: 0:00:00
70% (7 of 10) |################### | Elapsed Time: 0:00:00 ETA: 0:00:00
80% (8 of 10) |###################### | Elapsed Time: 0:00:00 ETA: 0:00:00
90% (9 of 10) |######################### | Elapsed Time: 0:00:00 ETA: 0:00:00
100% (10 of 10) |#############################| Elapsed Time: 0:00:00 Time: 0.12
While it looks weird, it's just adjusting to the width of the terminal (80 characters) and at the last line the Time: 1.00
is less wide than the ETA: 0:00:0
which causes it to be wider. Also, the 10 of 10
is wider than 9 of 10
which causes it to move.
I'll see if I can make those (mostly) fixed size to make it cleaner.
from python-progressbar.
Release 3.4.0 tries to make sure that the widgets always keep the same size. It won't work in all cases but many cases should be handled now.
from python-progressbar.
Now i do not get any progressbar at all.
100% (100 of 100) || Elapsed Time: 0:00:10 Time: 0:00:10-
from python-progressbar.
That means something is wrong with the width detection... I tested it in several environments and it appeared to work but apparently it's still broken :(
Sorry about that, I'll have a look at it.
from python-progressbar.
And on windows I get:
AttributeError: module 'signal' has no attribute 'SIGWINCH'
for
from progressbar import ProgressBar
progress = ProgressBar()
from python-progressbar.
Oh, and I think you misunderstood: This is the exact output I posted.
Every time the progressbar was updated a new line was started, because it was slidly wider (1 or a feq charakters) than the line width.
I did not mean, that the last progressbar is wider than the others.
from python-progressbar.
That would actually be the effect if the width can't be detected. The bar should automatically resize to the size of your screen. But if your screen is somehow 0 (broken detection code), it makes the bar as small as possible. Regardless, it's significantly broken unfortunately :(
I've removed the release from pypi for the time being and I'll try to update the package soon.
from python-progressbar.
Using blessings.Terminal gives me the correct results.
from python-progressbar.
Just playing around a bit:
from blessings import Terminal
from time import sleep
t = Terminal()
with t.hidden_cursor():
for i in range(101):
percentage = '{:>3d} %'.format(i)
start = '|'
end = '|'
barlength = t.width - (len(percentage) + len(start) + len(end))
len_progress = max(int(round(barlength * (i/100), 0)) - 1, 0)
bar = '=' * len_progress
arrow = '>' if i < 100 else '='
empty = ' ' * (barlength - len_progress - 1)
full = percentage + start + bar + arrow + empty + end
print('\r' + full, end='')
print(t.move_right(1) + t.clear_eos, end='', flush=True)
sleep(0.1)
from python-progressbar.
Blessings is a very nice module as well, I've added the module as a width detection option for people that have it installed but it still has some detection if it's not available
from python-progressbar.
Sorry for the trouble Max, I believe the current release should fix everything.
from python-progressbar.
Ah yes. I think you forgot a debug output:
shutil 48 111
An idea: Elapsed Time: ...
takes very much space. Could you maybe reduce the number of widgets automatically if the term width is so small, that no progressbar fits any more? First dropping Elapsed Time, than the ETA?
from python-progressbar.
Oops... indeed, it's gone now :)
As for collapsing widgets, not impossible to achieve but I'm not sure how to implement that cleanly in the base code. Generally screens are fairly large these days but it's a bit of a waste of screenspace indeed.
I've just pushed out a new release that has support for something along those lines. Give this code a try:
import time
import progressbar
bar = progressbar.ProgressBar(widgets=[
progressbar.Timer(min_width=200),
progressbar.Bar(),
])
for i in bar(range(200)):
time.sleep(0.1)
from python-progressbar.
Note that the min_width
and max_width
settings indicate the width in characters, not pixels. So if the screen is at least 200 characters wide, the Timer
will show.
from python-progressbar.
Related Issues (20)
- Question: multiprocessing, logging and progressbar HOT 3
- ValueError: Value 40 is out of range, should be between 0 and 39 HOT 1
- Is there a way to wrap the progress bar output? HOT 2
- Timer and AdaptiveETA, possibly other time widgets print incorrect output when used with format kwarg HOT 1
- Is there a way to have multiple concurrent and independent progress bars? HOT 7
- progressbar suddenly throwing 'function' object has no attribute 'ProgressBar' HOT 2
- Not sure how to go about doing this HOT 4
- outdatated progress bar? HOT 1
- Preventing regular ETA update or replacing it HOT 8
- ETA does not honor empty `format_finished` HOT 5
- Replace the moving average algorithm
- Not an issue but an idea HOT 4
- MultiBar does not work if any of the node has an empty string as key HOT 1
- Colored markers HOT 7
- `cli-name` executable refers to non-existing Python module HOT 4
- 4.3.0: Windows OS: TypeError: '_fields_' must be a sequence of (name, C type) pairs HOT 3
- Progressbar update creates multiple lines HOT 19
- ProgressBar update no longer works with floats. HOT 3
- version 4.4: interactive shell: arrow keys yield weird symbols HOT 11
- Color support and ANSI terminal detection on Windows (broken for CMD.exe and Powershell.exe) HOT 6
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 python-progressbar.