forked from sebp/PyGObject-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogressbar.txt
More file actions
37 lines (30 loc) · 1.71 KB
/
progressbar.txt
File metadata and controls
37 lines (30 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
ProgressBar
===========
The :class:`Gtk.ProgressBar` is typically used to display the progress of a
long running operation. It provides a visual clue that processing is underway.
The :class:`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 :class:`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 :meth:`Gtk.ProgressBar.set_fraction`
periodically to update the progress bar, passing a float between 0 and 1 to provide
the new percentage value.
When an application has no accurate way of knowing the amount of work to do, it
can use *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
:meth:`Gtk.ProgressBar.pulse` periodically to update the progress bar.
You can also choose the step size, with the :meth:`Gtk.ProgressBar.set_pulse_step`
method.
By default, :class:`Gtk.ProgressBar` is horizontal and left-to-right, but you
can change it to a vertical progress bar by using the
:meth:`Gtk.ProgressBar.set_orientation` method. Changing the direction the
progress bar grows can be done using :meth:`Gtk.ProgressBar.set_inverted`.
:class:`Gtk.ProgressBar` can also contain text which can be set by calling
:meth:`Gtk.ProgressBar.set_text` and :meth:`Gtk.ProgressBar.set_show_text`.
Example
-------
.. image:: ../images/progressbar_example.png
.. literalinclude:: ../examples/progressbar_example.py
:linenos: