Skip to content

Gtk.CellRendererToggle

class — extends CellRenderer

:::warning Deprecated since 4.10 This API is deprecated. :::

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

new

@classmethod
def new(cls) -> CellRenderer

:::warning Deprecated since 4.10 This API is deprecated. :::

Creates a new GtkCellRendererToggle. Adjust rendering parameters using object properties. Object properties can be set globally (with g_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.

Methods

get_activatable

def get_activatable(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns whether the cell renderer is activatable. See CellRendererToggle.set_activatable.

get_active

def get_active(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns whether the cell renderer is active. See CellRendererToggle.set_active.

get_radio

def get_radio(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns whether we’re rendering radio toggles rather than checkboxes.

set_activatable

def set_activatable(self, setting: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Makes the cell renderer activatable.

Parameters:

  • setting — the value to set.

set_active

def set_active(self, setting: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Activates or deactivates a cell renderer.

Parameters:

  • setting — the value to set.

set_radio

def set_radio(self, radio: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

If radio is True, the cell renderer renders a radio toggle (i.e. a toggle in a group of mutually-exclusive toggles). If 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).

Parameters:

  • radioTrue to make the toggle look like a radio button

Properties

activatable

activatable: bool  # read/write

active

active: bool  # read/write

inconsistent

inconsistent: bool  # read/write

radio

radio: bool  # read/write

Signals

toggled

def on_toggled(self, 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.