Blame platform-demos/C/progressbar.py.page

Packit 1470ea
Packit 1470ea
Packit 1470ea
      xmlns:its="http://www.w3.org/2005/11/its"
Packit 1470ea
      xmlns:xi="http://www.w3.org/2001/XInclude"
Packit 1470ea
      type="guide" style="task"
Packit 1470ea
      id="progressbar.py">
Packit 1470ea
  <info>
Packit 1470ea
    <title type="text">ProgressBar (Python)</title>
Packit 1470ea
    <link type="guide" xref="beginner.py#display-widgets"/>
Packit 1470ea
    <link type="next" xref="spinbutton.py" />    
Packit 1470ea
    <revision version="0.2" date="2012-06-12" status="draft"/>
Packit 1470ea
Packit 1470ea
    <credit type="author copyright">
Packit 1470ea
      <name>Marta Maria Casetti</name>
Packit 1470ea
      <email its:translate="no">mmcasetti@gmail.com</email>
Packit 1470ea
      <years>2012</years>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
    <desc>A widget which indicates progress visually.</desc>
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
  <title>ProgressBar</title>
Packit 1470ea
  <media type="video" mime="application/ogv" src="media/progressbar.ogv">
Packit 1470ea
    <tt:tt xmlns:tt="http://www.w3.org/ns/ttml">
Packit 1470ea
      <tt:body>
Packit 1470ea
        <tt:div begin="0s" end="6s">
Packit 1470ea
          <tt:p>
Packit 1470ea
              Pressing any key stops and starts this ProgressBar.
Packit 1470ea
          </tt:p>
Packit 1470ea
        </tt:div>
Packit 1470ea
      </tt:body>
Packit 1470ea
    </tt:tt>
Packit 1470ea
  </media>
Packit 1470ea
  

This ProgressBar is stopped and started by pressing any key.

Packit 1470ea
Packit 1470ea
  <links type="section" />
Packit 1470ea
Packit 1470ea
  <section id="code">
Packit 1470ea
  <title>Code used to generate this example</title>
Packit 1470ea
Packit 1470ea
  <xi:include href="samples/progressbar.py" parse="text"><xi:fallback/></xi:include>
Packit 1470ea
Packit 1470ea
  </section>
Packit 1470ea
Packit 1470ea
  <section id="methods">
Packit 1470ea
  <title>Useful methods for a ProgressBar widget</title>
Packit 1470ea
  <list>
Packit 1470ea
    <item>

Instead of pulse(), that makes the bar go back and forth, if we want the ProgressBar to "fill in" a fraction (a float between 0.0 and 1.0 included) of the bar that has been completed, use set_fraction(fraction).

</item>
Packit 1470ea
    <item>

To set a text and show it (superimposed over the bar) use set_text("text") and set_show_text(True). If a text is not set and set_show_text(True) the text will be the percentage of the work that has been completed.

</item>
Packit 1470ea
  </list>
Packit 1470ea
  </section>
Packit 1470ea
Packit 1470ea
  <section id="references">
Packit 1470ea
  <title>API References</title>
Packit 1470ea
  

In this sample we used the following:

Packit 1470ea
  <list>
Packit 1470ea
    <item>

<link href="http://developer.gnome.org/gtk3/unstable/GtkProgressBar.html">GtkProgressBar</link>

</item>
Packit 1470ea
    <item>

<link href="http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html">GLib - The Main Event Loop</link>

</item>
Packit 1470ea
    <item>

<link href="http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling">Gdk - Key Values</link>

</item>
Packit 1470ea
  </list>
Packit 1470ea
  </section>
Packit 1470ea
</page>