gtk.progress_bar
Module for [ProgressBar] class
Types 3
[gtk.progress_bar.ProgressBar] is typically used to display the progress of a long running operation.
It provides a visual clue that processing is underway. [gtk.progress_bar.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.progress_bar.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 [gtk.progress_bar.ProgressBar.setFraction] 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.progress_bar.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 [gtk.progress_bar.ProgressBar.pulse] periodically to update the progress bar.
There is quite a bit of flexibility provided to control the appearance of the [gtk.progress_bar.ProgressBar]. Functions 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.
CSS nodes
progressbar[.osd]
├── [text]
╰── trough[.empty][.full]
╰── progress[.pulse][gtk.progress_bar.ProgressBar] has a main CSS node with name progressbar and subnodes with names text and trough, of which the latter has a subnode named progress. The text subnode is only present if text is shown. The progress subnode has the style class .pulse when in activity mode. It gets the style classes .left, .right, .top or .bottom added when the progress 'touches' the corresponding end of the GtkProgressBar. The .osd class on the progressbar node is for use in overlays like the one Epiphany has for page loading progress.
Accessibility
[gtk.progress_bar.ProgressBar] uses the [gtk.types.AccessibleRole.ProgressBar] role.
ProgressBar self()Returns `this`, for use in `with` statements.ProgressBarGidBuilder builder()Get builder for [gtk.progress_bar.ProgressBar] Returns: New builder objectpango.types.EllipsizeMode ellipsize() @propertyGet `ellipsize` property. Returns: The preferred place to ellipsize the string.void ellipsize(pango.types.EllipsizeMode propval) @propertySet `ellipsize` property. Params: propval = The preferred place to ellipsize the string.double fraction() @propertyGet `fraction` property. Returns: The fraction of total work that has been completed.void fraction(double propval) @propertySet `fraction` property. Params: propval = The fraction of total work that has been completed.bool inverted() @propertyGet `inverted` property. Returns: Invert the direction in which the progress bar grows.void inverted(bool propval) @propertySet `inverted` property. Params: propval = Invert the direction in which the progress bar grows.double pulseStep() @propertyGet `pulseStep` property. Returns: The fraction of total progress to move the bounding block when pulsed.void pulseStep(double propval) @propertySet `pulseStep` property. Params: propval = The fraction of total progress to move the bounding block when pulsed.bool showText() @propertyGet `showText` property. Returns: Sets whether the progress bar will show a text in addition to the bar itself.void showText(bool propval) @propertySet `showText` property. Params: propval = Sets whether the progress bar will show a text in addition to the bar itself.void text(string propval) @propertySet `text` property. Params: propval = Text to be displayed in the progress bar.pango.types.EllipsizeMode getEllipsize()Returns the ellipsizing position of the progress bar.double getFraction()Returns the current fraction of the task that’s been completed. Returns: a fraction from 0.0 to 1.0bool getInverted()Returns whether the progress bar is inverted. Returns: true if the progress bar is inverteddouble getPulseStep()Retrieves the pulse step.bool getShowText()Returns whether the [gtk.progress_bar.ProgressBar] shows text.string getText()Retrieves the text that is displayed with the progress bar.void pulse()Indicates that some progress has been made, but you don’t know how much.void setEllipsize(pango.types.EllipsizeMode mode)Sets the mode used to ellipsize the text.void setFraction(double fraction)Causes the progress bar to “fill in” the given fraction of the bar.void setInverted(bool inverted)Sets whether the progress bar is inverted.void setPulseStep(double fraction)Sets the fraction of total progress bar length to move the bouncing block.void setShowText(bool showText)Sets whether the progress bar will show text next to the bar.void setText(string text = null)Causes the given text to appear next to the progress bar.T ellipsize(pango.types.EllipsizeMode propval)Set `ellipsize` property. Params: propval = The preferred place to ellipsize the string.T fraction(double propval)Set `fraction` property. Params: propval = The fraction of total work that has been completed. Returns: Builder instance for fluent chainingT inverted(bool propval)Set `inverted` property. Params: propval = Invert the direction in which the progress bar grows. Returns: Builder instance for fluent chainingT pulseStep(double propval)Set `pulseStep` property. Params: propval = The fraction of total progress to move the bounding block when pulsed. Returns: Builder instance for fluent chainingT showText(bool propval)Set `showText` property. Params: propval = Sets whether the progress bar will show a text in addition to the bar itself.T text(string propval)Set `text` property. Params: propval = Text to be displayed in the progress bar. Returns: Builder instance for fluent chainingFluent builder for [gtk.progress_bar.ProgressBar]
ProgressBar build()