Debian Codegraph @

docs/tutorials/gtk4/controls/switch.rst

raw
1 .. currentmodule:: gi.repository
2
3 Switch
4 ======
5 A :class:`Gtk.Switch` is a widget that has two states: on or off. The user can
6 control which state should be active by clicking the empty area, or by dragging
7 the handle.
8
9 You shouldn't use the ``activate`` signal on the Gtk.Switch which is an action
10 signal and emitting it causes the switch to animate. Applications should never
11 connect to this signal, but use the ``notify::active`` signal, see the example
12 here below.
13
14 Example
15 ^^^^^^^
16
17 .. image:: images/switch.png
18
19 .. literalinclude:: examples/switch.py
20 :linenos: