Gtk.CellRendererToggle

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.CellRenderer Gtk.CellRenderer GObject.InitiallyUnowned->Gtk.CellRenderer GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.CellRendererToggle Gtk.CellRendererToggle Gtk.CellRenderer->Gtk.CellRendererToggle

Subclasses:None

Virtual Methods

Inherited:Gtk.CellRenderer (12), GObject.Object (7)
  do_toggled (path)

Properties

Inherited:Gtk.CellRenderer (16)
Name Type Flags Short Description
activatable bool r/w/en The toggle button can be activated
active bool r/w/en The toggle state of the button
inconsistent bool r/w/en The inconsistent state of the button
indicator-size int d/r/w/en Size of check or radio indicator deprecated
radio bool r/w/en Draw the toggle button as a radio button

Signals

Inherited:Gtk.CellRenderer (2), GObject.Object (1)
Name Short Description
toggled The ::toggled signal is emitted when the cell is toggled.

Fields

Inherited:Gtk.CellRenderer (2), GObject.Object (1)
Name Type Access Description
parent Gtk.CellRenderer r  

Class Details

class Gtk.CellRendererToggle(**kwargs)
Bases:Gtk.CellRenderer
Abstract:No
Structure:Gtk.CellRendererToggleClass

Gtk.CellRendererToggle renders a toggle button in a cell. The button is drawn as a radio or a checkbutton, depending on the Gtk.CellRendererToggle :radio property. When activated, it emits the Gtk.CellRendererToggle ::toggled signal.

classmethod new()[source]
Returns:the new cell renderer
Return type:Gtk.CellRenderer

Creates a new Gtk.CellRendererToggle. Adjust rendering parameters using object properties. Object properties can be set globally (with g_object_set()). Also, with Gtk.TreeViewColumn, you can bind a property to a value in a Gtk.TreeModel. 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.

get_activatable()[source]
Returns:True if the cell renderer is activatable.
Return type:bool

Returns whether the cell renderer is activatable. See Gtk.CellRendererToggle.set_activatable().

New in version 2.18.

get_active()[source]
Returns:True if the cell renderer is active.
Return type:bool

Returns whether the cell renderer is active. See Gtk.CellRendererToggle.set_active().

get_radio()[source]
Returns:True if we’re rendering radio toggles rather than checkboxes
Return type:bool

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

set_activatable(setting)[source]
Parameters:setting (bool) – the value to set.

Makes the cell renderer activatable.

New in version 2.18.

set_active(setting)[source]
Parameters:setting (bool) – the value to set.

Activates or deactivates a cell renderer.

set_radio(radio)[source]
Parameters:radio (bool) – True to make the toggle look like a radio button

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 Gtk.TreeView, you set up a per-row setting using Gtk.TreeViewColumn to associate model columns with cell renderer properties).

do_toggled(path) virtual
Parameters:path (str) –

Signal Details

Gtk.CellRendererToggle.signals.toggled(cell_renderer_toggle, path)
Signal Name:

toggled

Flags:

RUN_LAST

Parameters:

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.

Property Details

Gtk.CellRendererToggle.props.activatable
Name:activatable
Type:bool
Default Value:True
Flags:READABLE, WRITABLE, EXPLICIT_NOTIFY

The toggle button can be activated

Gtk.CellRendererToggle.props.active
Name:active
Type:bool
Default Value:False
Flags:READABLE, WRITABLE, EXPLICIT_NOTIFY

The toggle state of the button

Gtk.CellRendererToggle.props.inconsistent
Name:inconsistent
Type:bool
Default Value:False
Flags:READABLE, WRITABLE, EXPLICIT_NOTIFY

The inconsistent state of the button

Gtk.CellRendererToggle.props.indicator_size
Name:indicator-size
Type:int
Default Value:0
Flags:DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Size of check or radio indicator

Deprecated since version ???.

Gtk.CellRendererToggle.props.radio
Name:radio
Type:bool
Default Value:False
Flags:READABLE, WRITABLE, EXPLICIT_NOTIFY

Draw the toggle button as a radio button