Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Example for a spinner animation #18

Merged
merged 2 commits into from

2 participants

@vaporup

No description provided.

@sebp sebp merged commit c1da137 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 2, 2012
  1. Added spinner animation example

    vaporup authored
  2. Index entry for spinner animation

    vaporup authored
This page is out of date. Refresh to see the latest.
View
39 examples/spinner_example.py
@@ -0,0 +1,39 @@
+
+from gi.repository import Gtk
+
+class SpinnerAnimation(Gtk.Window):
+
+ def __init__(self):
+
+ Gtk.Window.__init__(self, title="Spinner")
+ self.set_border_width(3)
+ self.connect("delete-event", Gtk.main_quit)
+
+ self.button = Gtk.ToggleButton("Start Spinning")
+ self.button.connect("toggled", self.on_button_toggled)
+ self.button.set_active(False)
+
+ self.spinner = Gtk.Spinner()
+
+ self.table = Gtk.Table(3, 2, True)
+ self.table.attach(self.button, 0, 2, 0, 1)
+ self.table.attach(self.spinner, 0, 2, 2, 3)
+
+ self.add(self.table)
+ self.show_all()
+
+ def on_button_toggled(self, button):
+
+ if button.get_active():
+ self.spinner.start()
+ self.button.set_label("Stop Spinning")
+
+ else:
+ self.spinner.stop()
+ self.button.set_label("Start Spinning")
+
+
+myspinner = SpinnerAnimation()
+
+Gtk.main()
+
View
BIN  images/spinner_example.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  source/index.txt
@@ -42,6 +42,7 @@ Contents:
entry
button_widgets
progressbar
+ spinner
treeview
cellrenderers
combobox
View
30 source/spinner.txt
@@ -0,0 +1,30 @@
+Spinner
+=======
+
+The :class:`Gtk.Spinner` displays an icon-size spinning animation.
+It is often used as an alternative to a :class:`GtkProgressBar`
+for displaying indefinite activity, instead of actual progress.
+
+To start the animation, use :meth:`Gtk.Spinner.start`,
+to stop it use :meth:`Gtk.Spinner.stop`.
+
+Spinner Objects
+----------------
+
+.. class:: Gtk.Spinner()
+
+ .. method:: start()
+
+ Starts the animation of the spinner.
+
+ .. method:: stop()
+
+ Stops the animation of the spinner.
+
+Example
+-------
+
+.. image:: ../images/spinner_example.png
+
+.. literalinclude:: ../examples/spinner_example.py
+ :linenos:
Something went wrong with that request. Please try again.