:right-sidebar: True ProgressBar =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: ProgressBar(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.AccessibleRange`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Orientable` :Constructors: :: ProgressBar(**properties) new() -> Gtk.Widget Constructors ------------ .. rst-class:: interim-class .. class:: ProgressBar :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``GtkProgressBar``. Methods ------- .. rst-class:: interim-class .. class:: ProgressBar :no-index: .. method:: get_ellipsize() -> ~gi.repository.Pango.EllipsizeMode Returns the ellipsizing position of the progress bar. See :obj:`~gi.repository.Gtk.ProgressBar.set_ellipsize`. .. method:: get_fraction() -> float Returns the current fraction of the task that’s been completed. .. method:: get_inverted() -> bool Returns whether the progress bar is inverted. .. method:: get_pulse_step() -> float Retrieves the pulse step. See :obj:`~gi.repository.Gtk.ProgressBar.set_pulse_step`. .. method:: get_show_text() -> bool Returns whether the ``GtkProgressBar`` shows text. See :obj:`~gi.repository.Gtk.ProgressBar.set_show_text`. .. method:: get_text() -> str | None Retrieves the text that is displayed with the progress bar. The return value is a reference to the text, not a copy of it, so will become invalid if you change the text in the progress bar. .. method:: pulse() -> None 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 :obj:`~gi.repository.Gtk.ProgressBar.pulse` causes the block to move by a little bit (the amount of movement per pulse is determined by :obj:`~gi.repository.Gtk.ProgressBar.set_pulse_step`). .. method:: set_ellipsize(mode: ~gi.repository.Pango.EllipsizeMode) -> None Sets the mode used to ellipsize the text. The text is ellipsized if there is not enough space to render the entire string. :param mode: a ``PangoEllipsizeMode`` .. method:: set_fraction(fraction: float) -> None Causes the progress bar to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive. :param fraction: fraction of the task that’s been completed .. method:: set_inverted(inverted: bool) -> None Sets whether the progress bar is inverted. Progress bars normally grow from top to bottom or left to right. Inverted progress bars grow in the opposite direction. :param inverted: :const:`True` to invert the progress bar .. method:: set_pulse_step(fraction: float) -> None Sets the fraction of total progress bar length to move the bouncing block. The bouncing block is moved when :obj:`~gi.repository.Gtk.ProgressBar.pulse` is called. :param fraction: fraction between 0.0 and 1.0 .. method:: set_show_text(show_text: bool) -> None Sets whether the progress bar will show text next to the bar. The shown text is either the value of the :obj:`~gi.repository.Gtk.ProgressBar.props.text` property or, if that is :const:`None`, the :obj:`~gi.repository.Gtk.ProgressBar.props.fraction` value, as a percentage. To make a progress bar that is styled and sized suitably for containing text (even if the actual text is blank), set :obj:`~gi.repository.Gtk.ProgressBar.props.show_text` to :const:`True` and :obj:`~gi.repository.Gtk.ProgressBar.props.text` to the empty string (not :const:`None`). :param show_text: whether to show text .. method:: set_text(text: str | None = None) -> None Causes the given ``text`` to appear next to the progress bar. If ``text`` is :const:`None` and :obj:`~gi.repository.Gtk.ProgressBar.props.show_text` is :const:`True`, the current value of :obj:`~gi.repository.Gtk.ProgressBar.props.fraction` will be displayed as a percentage. If ``text`` is non-:const:`None` and :obj:`~gi.repository.Gtk.ProgressBar.props.show_text` is :const:`True`, the text will be displayed. In this case, it will not display the progress percentage. If ``text`` is the empty string, the progress bar will still be styled and sized suitably for containing text, as long as :obj:`~gi.repository.Gtk.ProgressBar.props.show_text` is :const:`True`. :param text: a UTF-8 string Properties ---------- .. rst-class:: interim-class .. class:: ProgressBar :no-index: .. attribute:: props.ellipsize :type: ~gi.repository.Pango.EllipsizeMode The preferred place to ellipsize the string. The text will be ellipsized if the progress bar does not have enough room to display the entire string, specified as a ``PangoEllipsizeMode``. Note that setting this property to a value other than ``%PANGO_ELLIPSIZE_NONE`` has the side-effect that the progress bar requests only enough space to display the ellipsis ("..."). Another means to set a progress bar's width is :obj:`~gi.repository.Gtk.Widget.set_size_request`. .. attribute:: props.fraction :type: float The fraction of total work that has been completed. .. attribute:: props.inverted :type: bool Invert the direction in which the progress bar grows. .. attribute:: props.pulse_step :type: float The fraction of total progress to move the bounding block when pulsed. .. attribute:: props.show_text :type: bool Sets whether the progress bar will show a text in addition to the bar itself. The shown text is either the value of the :obj:`~gi.repository.Gtk.ProgressBar.props.text` property or, if that is :const:`None`, the :obj:`~gi.repository.Gtk.ProgressBar.props.fraction` value, as a percentage. To make a progress bar that is styled and sized suitably for showing text (even if the actual text is blank), set :obj:`~gi.repository.Gtk.ProgressBar.props.show_text` to :const:`True` and :obj:`~gi.repository.Gtk.ProgressBar.props.text` to the empty string (not :const:`None`). .. attribute:: props.text :type: str Text to be displayed in the progress bar.