gtk.ProgressBar

gtk.ProgressBar — a widget which indicates progress visually.

Synopsis

class gtk.ProgressBar(gtk.Progress):
    gtk.ProgressBar()
def pulse()
def set_text(text)
def set_fraction(fraction)
def set_pulse_step(fraction)
def set_orientation(orientation)
def get_text()
def get_fraction()
def get_pulse_step()
def get_orientation()
def set_ellipsize(mode)
def get_ellipsize()

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Progress
        +-- gtk.ProgressBar

gtk.ProgressBar Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Progress Properties

"discrete-blocks"Read-WriteThe number of discrete blocks in a progress bar (when shown in the discrete style)
"ellipsize"Read-WriteThe preferred place to ellipsize the string, if the progressbar does not have enough room to display the entire string, specified as one of the Pango Ellipsize Mode Constants. Note that setting this property to a value other than pango.ELLIPSIZE_NONE has the side-effect that the progressbar requests only enough space to display the ellipsis "...". Another means to set a progressbar's width is the gtk.Widget.set_size_request(). This property is available in GTK+ 2.6 and above.
"fraction"Read-WriteThe fraction of total work that has been completed
"orientation"Read-WriteThe orientation and growth direction of the progress bar - one of the GTK ProgressBar Orientation Constants: gtk.PROGRESS_LEFT_TO_RIGHT, gtk.PROGRESS_RIGHT_TO_LEFT, gtk.PROGRESS_BOTTOM_TO_TOP, gtk.PROGRESS_TOP_TO_BOTTOM
"pulse-step"Read-WriteThe fraction of total progress to move the bouncing block when pulsed
"text"Read-WriteThe text to be displayed in the progress bar

gtk.ProgressBar Style Properties

gtk.Widget Style Properties

gtk.ProgressBar Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

Description

The gtk.ProgressBar is typically used to display the progress of a long running operation. It provides a visual clue that processing is underway. The gtk.ProgressBar can be used in two different modes: percentage mode and activity mode.

When an application can determine how much work needs to take place (e.g. read a fixed number of bytes from a file) and can monitor its progress, it can use the gtk.ProgressBar in percentage mode and the user sees a growing bar indicating the percentage of the work that has been completed. In this mode, the application is required to call the set_fraction() method periodically to update the progress bar.

When an application has no accurate way of knowing the amount of work to do, it can use the gtk.ProgressBar in activity mode, which shows activity by a block moving back and forth within the progress area. In this mode, the application is required to call the pulse() method periodically to update the progress bar.

There is quite a bit of flexibility provided to control the appearance of the gtk.ProgressBar. Methods are provided to control the orientation of the bar, optional text can be displayed along with the bar, and the step size used in activity mode can be set.

Constructor

    gtk.ProgressBar()
Returns :a new gtk.ProgressBar widget

Creates a new gtk.Progressbar widget.

Methods

gtk.ProgressBar.pulse

    def pulse()

The pulse() method nudges the progressbar to indicate that some progress has been made, but you don't know how much. This method also changes progress bar mode to "activity mode," where a block bounces back and forth. Each call to the pulse() method causes the block to move by a little bit (the amount of movement per pulse is determined by the set_pulse_step() method).

gtk.ProgressBar.set_text

    def set_text(text)
text :a UTF-8 string

The set_text() method superimposes the text specified by text on the progress bar.

gtk.ProgressBar.set_fraction

    def set_fraction(fraction)
fraction :the fraction of the task that's been completed

The set_fraction() method causes the progress bar to "fill in" the portion of the bar specified by fraction. The value of fraction should be between 0.0 and 1.0.

gtk.ProgressBar.set_pulse_step

    def set_pulse_step(fraction)
fraction :a value between 0.0 and 1.0

The set_pulse_step() method sets the portion (specified by fraction) of the total progress bar length to move the bouncing block for each call to the pulse() method.

gtk.ProgressBar.set_orientation

    def set_orientation(orientation)
orientation :the orientation of the progress bar

The set_orientation() method switches the progress bar to a different orientation as specified by the value of orientation. The value of orientation must be one of the GTK ProgressBar Orientation Constants.

gtk.ProgressBar.get_text

    def get_text()
Returns :the text, or None

The get_text() method returns the text superimposed on the progress bar. If there is no superimposed text this method returns None.

gtk.ProgressBar.get_fraction

    def get_fraction()
Returns :a fraction from 0.0 to 1.0

The get_fraction() method returns the current fraction of the task that's been set by the set_fraction() method .

gtk.ProgressBar.get_pulse_step

    def get_pulse_step()
Returns :a fraction from 0.0 to 1.0

The get_pulse_step() method returns the pulse step set with the set_pulse_step().

gtk.ProgressBar.get_orientation

    def get_orientation()
Returns :the orientation of the progress bar

The get_orientation() method returns the current progress bar orientation. See the set_orientation() method for information about the orientation values.

gtk.ProgressBar.set_ellipsize

    def set_ellipsize(mode)
mode :one of the Pango Ellipsize Mode Constants

Note

This method is available in PyGTK 2.6 and above.

The set_ellipsize() method sets the mode used to ellipsize (add an ellipsis "...") the text if there is not enough space to render the entire string to the value specified by mode. mode must be one of the Pango Ellipsize Mode Constants

gtk.ProgressBar.get_ellipsize

    def get_ellipsize()
Returns :the mode used to ellipsize text

Note

This method is available in PyGTK 2.6 and above.

The get_ellipsize() method returns the mode used to ellipsize text when there is not enough space. See the set_ellipsize() method for information.