ProgressBar

Progress bars are used to show the status of an ongoing operation. For instance, a ProgressBar can show how much of a task has been completed.

To change the value shown, use the set_fraction() method, passing a double between 0 and 1 to provide the new percentage.

where percentage is a number, from 0 to 1, indicating what fraction of the bar should be filled.

A ProgressBaris horizontal and left-to-right by default, but you can change it to a vertical progress bar by using the set_orientation() method.

Reference

Activity Mode

Besides indicating the amount of progress that has occured, the progress bar can also be used to indicate that there is some activity; this is done by placing the progress bar in activity mode. In this mode, the progress bar displays a small rectangle which moves back and forth. Activity mode is useful in situations where the progress of an operation cannot be calculated as a value range (e.g., receiving a file of unknown length).

To do this, you need to call the pulse() method at regular intervals. You can also choose the step size, with the set_pulse_step() method.

When in continuous mode, the progress bar can also display a configurable text string within its trough, using the set_text() method.

Example

Figure 6.5. ProgressBar

Source Code