First time here? Check out the FAQ!

Ask Your Question
2

Create dynamically updatable progress bar

asked 13 years ago

Eugene gravatar image

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)
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 13 years ago

parzan gravatar image

Check out this discussion in stack-overflow.

Preview: (hide)
link

Comments

Indeed; you can also google for some more sophisticated progress bars implemented in Python.

niles gravatar imageniles ( 13 years ago )

Text progress bar is nice solution.. yet something graphical, which can be used within notebook is still desired.

Eugene gravatar imageEugene ( 13 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 13 years ago

Seen: 1,628 times

Last updated: Jul 29 '11