Open bendemott opened 3 years ago
bar.next()
does take an optional argument n
which defaults to 1 and specifies the amount to increment the bar's index by. See https://github.com/verigak/progress/blob/master/progress/__init__.py#L123.
So you can do something like:
data = b""
with progress.bar.Bar('Download', max=file_size) as bar:
while True:
packet = ftp.read()
bar.next(len(packet))
data += packet
if not packet: break
# Do something with data
With the current documentation a common use case which is advancing to a specific amount.
In the case of downloading a file from sftp (for example) the callback tells how many bytes have been transferred and how many bytes total. the
next()
method doesn't work in this case.for this case
bar.goto()
seems to work well but there are no examples in the documentation