Skip to content

GObject.BindingGroup

class — extends Object

GBindingGroup can be used to bind multiple properties from an object collectively.

Use the various methods to bind properties from a single source object to multiple destination objects. Properties can be bound bidirectionally and are connected when the source object is set with BindingGroup.set_source.

Constructors

new

@classmethod
def new(cls) -> BindingGroup

Creates a new BindingGroup.

Methods

bind

def bind(self, source_property: str, target: Object, target_property: str, flags: BindingFlags | int) -> None

Creates a binding between source_property on the source object and target_property on target. Whenever the source_property is changed the target_property is updated using the same value. The binding flag BindingFlags.SYNC_CREATE is automatically specified.

See Object.bind_property for more information.

Parameters:

  • source_property — the property on the source to bind
  • target — the target Object
  • target_property — the property on target to bind
  • flags — the flags used to create the Binding

bind_full

def bind_full(self, source_property: str, target: Object, target_property: str, flags: BindingFlags | int, transform_to: BindingTransformFunc | None = ..., transform_from: BindingTransformFunc | None = ...) -> None

Creates a binding between source_property on the source object and target_property on target, allowing you to set the transformation functions to be used by the binding. The binding flag BindingFlags.SYNC_CREATE is automatically specified.

See Object.bind_property_full for more information.

Parameters:

  • source_property — the property on the source to bind
  • target — the target Object
  • target_property — the property on target to bind
  • flags — the flags used to create the Binding
  • transform_to — the transformation function from the source object to the target, or None to use the default
  • transform_from — the transformation function from the target to the source object, or None to use the default

bind_with_closures

def bind_with_closures(self, source_property: str, target: Object, target_property: str, flags: BindingFlags | int, transform_to: Closure | None = ..., transform_from: Closure | None = ...) -> None

Creates a binding between source_property on the source object and target_property on target, allowing you to set the transformation functions to be used by the binding. The binding flag BindingFlags.SYNC_CREATE is automatically specified.

This function is the language bindings friendly version of g_binding_group_bind_property_full(), using GClosures instead of function pointers.

See Object.bind_property_with_closures for more information.

Parameters:

  • source_property — the property on the source to bind
  • target — the target Object
  • target_property — the property on target to bind
  • flags — the flags used to create the Binding
  • transform_to — a Closure wrapping the transformation function from the source object to the target, or None to use the default
  • transform_from — a Closure wrapping the transformation function from the target to the source object, or None to use the default

dup_source

def dup_source(self) -> Object | None

Gets the source object used for binding properties.

set_source

def set_source(self, source: Object | None = ...) -> None

Sets source as the source object used for creating property bindings. If there is already a source object all bindings from it will be removed.

Note that all properties that have been bound must exist on source.

Parameters:

  • source — the source Object, or None to clear it

Properties

source

source: Object  # read/write

The source object used for binding properties.