gtk.progress_bar
Module for [ProgressBar] class
Types 3
The #GtkProgressBar is typically used to display the progress of a long running operation. It provides a visual clue that processing is underway. The GtkProgressBar 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 GtkProgressBar 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 #GtkProgressBar 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 #GtkProgressBar. 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]GtkProgressBar 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.
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, if the progress bar does not have enough room to display the entire string, specified as a #PangoEllipsizeMode.void ellipsize(pango.types.EllipsizeMode propval) @propertySet `ellipsize` property. Params: propval = The preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, specified as a #PangoEllipsizeMode.double fraction() @propertyvoid fraction(double propval) @propertybool inverted() @propertyvoid inverted(bool propval) @propertydouble pulseStep() @propertyvoid pulseStep(double propval) @propertybool showText() @propertyGet `showText` property. Returns: Sets whether the progress bar will show a text in addition to the bar itself. The shown text is either the value of the #GtkProgressBar:text property or, if that i...void showText(bool propval) @propertySet `showText` property. Params: propval = Sets whether the progress bar will show a text in addition to the bar itself. The shown text is either the value of the #GtkProgressBar:text property or, ...string text() @propertyvoid text(string propval) @propertypango.types.EllipsizeMode getEllipsize()Returns the ellipsizing position of the progress bar. See [gtk.progress_bar.ProgressBar.setEllipsize]. Returns: #PangoEllipsizeModedouble getFraction()Returns the current fraction of the task that’s been completed. Returns: a fraction from 0.0 to 1.0bool getInverted()Gets the value set by [gtk.progress_bar.ProgressBar.setInverted]. Returns: true if the progress bar is inverteddouble getPulseStep()Retrieves the pulse step set with [gtk.progress_bar.ProgressBar.setPulseStep]. Returns: a fraction from 0.0 to 1.0bool getShowText()Gets the value of the #GtkProgressBar:show-text property. See [gtk.progress_bar.ProgressBar.setShowText]. Returns: true if text is shown in the progress barstring getText()Retrieves the text that is displayed with the progress bar, if any, otherwise null. The return value is a reference to the text, not a copy of it, so will become invalid if you change the text in t...void pulse()Indicates that some progress has been made, but you don’t know how much. Causes the progress bar to enter “activity mode,” where a block bounces back and forth. Each call to [gtk.progressbar....void setEllipsize(pango.types.EllipsizeMode mode)Sets the mode used to ellipsize (add an ellipsis: "...") the text if there is not enough space to render the entire string.void setFraction(double fraction)Causes the progress bar to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.void setInverted(bool inverted)Progress bars normally grow from top to bottom or left to right. Inverted progress bars grow in the opposite direction.void setPulseStep(double fraction)Sets the fraction of total progress bar length to move the bouncing block for each call to [gtk.progress_bar.ProgressBar.pulse].void setShowText(bool showText)Sets whether the progress bar will show text next to the bar. The shown text is either the value of the #GtkProgressBar:text property or, if that is null, the #GtkProgressBar:fraction value, as a p...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, if the progress bar does not have enough room to display the entire string, specified as a #PangoEllipsizeMode.T fraction(double propval)T inverted(bool propval)T pulseStep(double propval)T showText(bool propval)Set `showText` property. Params: propval = Sets whether the progress bar will show a text in addition to the bar itself. The shown text is either the value of the #GtkProgressBar:text property or, ...T text(string propval)Fluent builder for [gtk.progress_bar.ProgressBar]