Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I implement a progress bar

How do I implement a progress bar in jupyter-notebook?

I've done this:

count = 0 max_count = 100 bar_width = 40 while count <= max_count:     time.sleep(.1)     b = bar_width * count / max_count     l = bar_width - b     print '\r' + u"\u2588" * b + '-' * l,     count += 1 

Which is great when I have access to a loop in which to print stuff out. But does anyone know of anything clever to run a progress bar of some sort asynchronously?

like image 965
piRSquared Avatar asked Aug 09 '16 23:08

piRSquared


People also ask

How do I create a progress bar in Excel?

Step 2: Add the Progress Bars Next, highlight the cell range B2:B11 that contains the progress percentages, then click the Conditional Formatting icon on the Home tab, then click Data Bars, then click More Rules: A new window appears that allows you to format the data bars.

What is the method of progress bar?

Progress bars are used to show progress of a task. For example, when you are uploading or downloading something from the internet, it is better to show the progress of download/upload to the user. In android there is a class called ProgressDialog that allows you to create progress bar.

How do I create a progress bar in HTML?

Tip: Use the <progress> tag in conjunction with JavaScript to display the progress of a task. Note: The <progress> tag is not suitable for representing a gauge (e.g. disk space usage or relevance of a query result).


1 Answers

Here is a solution (following this).

from ipywidgets import IntProgress from IPython.display import display import time  max_count = 100  f = IntProgress(min=0, max=max_count) # instantiate the bar display(f) # display the bar  count = 0 while count <= max_count:     f.value += 1 # signal to increment the progress bar     time.sleep(.1)     count += 1 

If the value that's changing in the loop is a float instead of an int, you can use ipwidgets.FloatProgress instead.

like image 160
Stephen McAteer Avatar answered Nov 13 '22 22:11

Stephen McAteer