File: switch.rst

package info (click to toggle)
pygobject 3.54.5-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,864 kB
  • sloc: ansic: 40,281; python: 26,363; sh: 477; makefile: 81; xml: 35; cpp: 1
file content (20 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.. currentmodule:: gi.repository

Switch
======
A :class:`Gtk.Switch` is a widget that has two states: on or off. The user can
control which state should be active by clicking the empty area, or by dragging
the handle.

You shouldn't use the ``activate`` signal on the Gtk.Switch which is an action
signal and emitting it causes the switch to animate. Applications should never
connect to this signal, but use the ``notify::active`` signal, see the example
here below.

Example
^^^^^^^

.. image:: images/switch.png

.. literalinclude:: examples/switch.py
    :linenos: