ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 29 Jul 2011 13:25:07 +0200Create dynamically updatable progress barhttps://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/Hi!
Sometimes calculations takes a long time, and it'll be very useful to know the progress. A simple example:
from time import sleep
def slow_calculations():
for i in range(10):
sleep(0.5)
print 'Complete',(i+1)*10,'%'
print 'Done'
Such indication of process was my first solution. Is is possible somehow to draw a progress bar and update it's value during the calculations? Something like that:
def slow_calculations(bar):
for i in range(10):
sleep(0.5)
bar.value = (i+1)*10
progressBar= ProgressBar()
progressBar.show()
slow_calculations(progressBar)Fri, 29 Jul 2011 07:25:28 +0200https://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/Answer by parzan for <p>Hi!</p>
<p>Sometimes calculations takes a long time, and it'll be very useful to know the progress. A simple example:</p>
<pre><code>from time import sleep
def slow_calculations():
for i in range(10):
sleep(0.5)
print 'Complete',(i+1)*10,'%'
print 'Done'
</code></pre>
<p>Such indication of process was my first solution. Is is possible somehow to draw a progress bar and update it's value during the calculations? Something like that:</p>
<pre><code>def slow_calculations(bar):
for i in range(10):
sleep(0.5)
bar.value = (i+1)*10
progressBar= ProgressBar()
progressBar.show()
slow_calculations(progressBar)
</code></pre>
https://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/?answer=12540#post-id-12540Check out [this discussion](http://stackoverflow.com/questions/3160699/python-progress-bar) in stack-overflow.Fri, 29 Jul 2011 12:05:53 +0200https://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/?answer=12540#post-id-12540Comment by niles for <p>Check out <a href="http://stackoverflow.com/questions/3160699/python-progress-bar">this discussion</a> in stack-overflow.</p>
https://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/?comment=21446#post-id-21446Indeed; you can also google for some more sophisticated progress bars implemented in Python.Fri, 29 Jul 2011 12:11:03 +0200https://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/?comment=21446#post-id-21446Comment by Eugene for <p>Check out <a href="http://stackoverflow.com/questions/3160699/python-progress-bar">this discussion</a> in stack-overflow.</p>
https://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/?comment=21444#post-id-21444Text progress bar is nice solution.. yet something graphical, which can be used within notebook is still desired.Fri, 29 Jul 2011 13:25:07 +0200https://ask.sagemath.org/question/8245/create-dynamically-updatable-progress-bar/?comment=21444#post-id-21444