:right-sidebar: True CellRendererToggle =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 List views use widgets to display their contents. You should use :obj:`~gi.repository.Gtk.ToggleButton` instead .. class:: CellRendererToggle(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.CellRenderer`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Renders a toggle button in a cell ``GtkCellRendererToggle`` renders a toggle button in a cell. The button is drawn as a radio or a checkbutton, depending on the ``GtkCellRendererToggle:radio`` property. When activated, it emits the ``GtkCellRendererToggle::toggled`` signal. Constructors ------------ .. rst-class:: interim-class .. class:: CellRendererToggle :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.CellRenderer Creates a new ``GtkCellRendererToggle``. Adjust rendering parameters using object properties. Object properties can be set globally (with :func:`~gi.repository.GObject.GObject.Object.set`). Also, with ``GtkTreeViewColumn``, you can bind a property to a value in a ``GtkTreeModel``. For example, you can bind the “active” property on the cell renderer to a boolean value in the model, thus causing the check button to reflect the state of the model. .. deprecated:: 4.10 Please do not use it in newly written code Methods ------- .. rst-class:: interim-class .. class:: CellRendererToggle :no-index: .. method:: get_activatable() -> bool Returns whether the cell renderer is activatable. See :func:`~gi.repository.Gtk.CellRendererToggle.set_activatable`. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_active() -> bool Returns whether the cell renderer is active. See :func:`~gi.repository.Gtk.CellRendererToggle.set_active`. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_radio() -> bool Returns whether we’re rendering radio toggles rather than checkboxes. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: set_activatable(setting: bool) -> None Makes the cell renderer activatable. .. deprecated:: 4.10 Please do not use it in newly written code :param setting: the value to set. .. method:: set_active(setting: bool) -> None Activates or deactivates a cell renderer. .. deprecated:: 4.10 Please do not use it in newly written code :param setting: the value to set. .. method:: set_radio(radio: bool) -> None If ``radio`` is :const:`True`, the cell renderer renders a radio toggle (i.e. a toggle in a group of mutually-exclusive toggles). If :const:`False`, it renders a check toggle (a standalone boolean option). This can be set globally for the cell renderer, or changed just before rendering each cell in the model (for ``GtkTreeView``, you set up a per-row setting using ``GtkTreeViewColumn`` to associate model columns with cell renderer properties). .. deprecated:: 4.10 Please do not use it in newly written code :param radio: :const:`True` to make the toggle look like a radio button Properties ---------- .. rst-class:: interim-class .. class:: CellRendererToggle :no-index: .. attribute:: props.activatable :type: bool .. attribute:: props.active :type: bool .. attribute:: props.inconsistent :type: bool .. attribute:: props.radio :type: bool Signals ------- .. rst-class:: interim-class .. class:: CellRendererToggle.signals :no-index: .. method:: toggled(path: str) -> None The ::toggled signal is emitted when the cell is toggled. It is the responsibility of the application to update the model with the correct value to store at ``path``. Often this is simply the opposite of the value currently stored at ``path``. :param path: string representation of ``GtkTreePath`` describing the event location