Functions

add_emission_hook (type, name, callback, *user_data)

boxed_copy (boxed_type, src_boxed)

boxed_free (boxed_type, boxed)

cclosure_marshal_BOOLEAN__BOXED_BOXED (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_BOOLEAN__FLAGS (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_STRING__OBJECT_POINTER (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__BOOLEAN (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__BOXED (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__CHAR (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__DOUBLE (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__ENUM (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__FLAGS (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__FLOAT (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__INT (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__LONG (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__OBJECT (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__PARAM (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__POINTER (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__STRING (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__UCHAR (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__UINT (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__UINT_POINTER (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__ULONG (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__VARIANT (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_VOID__VOID (closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)

cclosure_marshal_generic (closure, return_gvalue, n_param_values, param_values, invocation_hint, marshal_data)

clear_signal_handler (handler_id_ptr, instance)

enum_complete_type_info (g_enum_type, const_values)

enum_get_value (enum_class, value)

enum_get_value_by_name (enum_class, name)

enum_get_value_by_nick (enum_class, nick)

enum_register_static (name, const_static_values)

enum_to_string (g_enum_type, value)

flags_complete_type_info (g_flags_type, const_values)

flags_get_first_value (flags_class, value)

flags_get_value_by_name (flags_class, name)

flags_get_value_by_nick (flags_class, nick)

flags_register_static (name, const_static_values)

flags_to_string (flags_type, value)

gtype_get_type ()

list_properties (type)

new (gtype_or_similar, **kwargs)

param_spec_boolean (name, nick, blurb, default_value, flags)

param_spec_boxed (name, nick, blurb, boxed_type, flags)

param_spec_char (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_double (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_enum (name, nick, blurb, enum_type, default_value, flags)

param_spec_flags (name, nick, blurb, flags_type, default_value, flags)

param_spec_float (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_gtype (name, nick, blurb, is_a_type, flags)

param_spec_int (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_int64 (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_long (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_object (name, nick, blurb, object_type, flags)

param_spec_param (name, nick, blurb, param_type, flags)

param_spec_pointer (name, nick, blurb, flags)

param_spec_string (name, nick, blurb, default_value, flags)

param_spec_uchar (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_uint (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_uint64 (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_ulong (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_unichar (name, nick, blurb, default_value, flags)

param_spec_variant (name, nick, blurb, type, default_value, flags)

param_type_register_static (name, pspec_info)

param_value_convert (pspec, src_value, dest_value, strict_validation)

param_value_defaults (pspec, value)

param_value_is_valid (pspec, value)

param_value_set_default (pspec, value)

param_value_validate (pspec, value)

param_values_cmp (pspec, value1, value2)

pointer_type_register_static (name)

remove_emission_hook (obj, detailed_signal, hook_id)

signal_accumulator_first_wins (ihint, return_accu, handler_return, dummy)

signal_accumulator_true_handled (ihint, return_accu, handler_return, dummy)

signal_add_emission_hook (signal_id, detail, hook_func)

signal_chain_from_overridden (instance_and_params, return_value)

signal_connect_closure (instance, detailed_signal, closure, after)

signal_connect_closure_by_id (instance, signal_id, detail, closure, after)

signal_emitv (instance_and_params, signal_id, detail, return_value)

signal_get_invocation_hint (instance)

signal_handler_block (instance, handler_id)

signal_handler_disconnect (instance, handler_id)

signal_handler_find (instance, mask, signal_id, detail, closure, func, data)

signal_handler_is_connected (instance, handler_id)

signal_handler_unblock (instance, handler_id)

signal_handlers_block_matched (instance, mask, signal_id, detail, closure, func, data)

signal_handlers_destroy (instance)

signal_handlers_disconnect_matched (instance, mask, signal_id, detail, closure, func, data)

signal_handlers_unblock_matched (instance, mask, signal_id, detail, closure, func, data)

signal_has_handler_pending (instance, signal_id, detail, may_be_blocked)

signal_is_valid_name (name)

signal_list_ids (itype)

signal_list_names (type_)

signal_lookup (name, itype)

signal_name (signal_id)

signal_new (signal_name, type, flags, return_type, param_types)

signal_override_class_closure (signal_id, instance_type, class_closure)

signal_parse_name (detailed_signal, itype, force_detail_quark)

signal_query (signal_id)

signal_remove_emission_hook (signal_id, hook_id)

signal_stop_emission (instance, signal_id, detail)

signal_stop_emission_by_name (instance, detailed_signal)

signal_type_cclosure_new (itype, struct_offset)

source_set_closure (source, closure)

source_set_dummy_callback (source)

strdup_value_contents (value)

type_add_class_private (class_type, private_size)

type_add_instance_private (class_type, private_size)

type_add_interface_dynamic (instance_type, interface_type, plugin)

type_add_interface_static (instance_type, interface_type, info)

type_check_class_is_a (g_class, is_a_type)

type_check_instance (instance)

type_check_instance_is_a (instance, iface_type)

type_check_instance_is_fundamentally_a (instance, fundamental_type)

type_check_is_value_type (type)

type_check_value (value)

type_check_value_holds (value, type)

type_children (type)

type_class_adjust_private_offset (g_class, private_size_or_offset)

type_class_peek (type)

type_class_peek_static (type)

type_class_ref (type)

type_default_interface_peek (g_type)

type_default_interface_ref (g_type)

type_default_interface_unref (g_iface)

type_depth (type)

type_ensure (type)

type_free_instance (instance)

type_from_name (name)

type_fundamental (type_id)

type_fundamental_next ()

type_get_instance_count (type)

type_get_plugin (type)

type_get_qdata (type, quark)

type_get_type_registration_serial ()

type_init ()

type_init_with_debug_flags (debug_flags)

type_interface_add_prerequisite (interface_type, prerequisite_type)

type_interface_get_plugin (instance_type, interface_type)

type_interface_instantiatable_prerequisite (interface_type)

type_interface_peek (instance_class, iface_type)

type_interface_prerequisites (interface_type)

type_interfaces (type)

type_is_a (type, is_a_type)

type_name (type)

type_name_from_class (g_class)

type_name_from_instance (instance)

type_next_base (leaf_type, root_type)

type_parent (type)

type_qname (type)

type_query (type)

type_register (class_)

type_register_dynamic (parent_type, type_name, plugin, flags)

type_register_fundamental (type_id, type_name, info, finfo, flags)

type_register_static (parent_type, type_name, info, flags)

type_set_qdata (type, quark, data)

type_test_flags (type, flags)

value_type_compatible (src_type, dest_type)

value_type_transformable (src_type, dest_type)

Details

GObject.add_emission_hook(type, name, callback, *user_data)
Parameters:
  • type (GObject.Object) – a Python GObject instance or type

  • name (str) – a signal name

  • callback – a function

  • user_data – zero or more extra arguments that will be passed to callback

The add_emission_hook() function adds an emission hook for the signal specified by name, which will get called for any emission of that signal, independent of the instance. This is possible only for signals which don’t have the GObject.SignalFlags.NO_HOOKS flag set.

GObject.boxed_copy(boxed_type, src_boxed)
Parameters:
  • boxed_type (GObject.GType) – The type of src_boxed.

  • src_boxed (object) – The boxed structure to be copied.

Returns:

The newly created copy of the boxed structure.

Return type:

object

Provide a copy of a boxed structure src_boxed which is of type boxed_type.

GObject.boxed_free(boxed_type, boxed)
Parameters:
  • boxed_type (GObject.GType) – The type of boxed.

  • boxed (object) – The boxed structure to be freed.

Free the boxed structure boxed which is of type boxed_type.

GObject.cclosure_marshal_BOOLEAN__BOXED_BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A GObject.ClosureMarshal function for use with signals with handlers that take two boxed pointers as arguments and return a boolean. If you have such a signal, you will probably also need to use an accumulator, such as GObject.signal_accumulator_true_handled().

GObject.cclosure_marshal_BOOLEAN__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data) where the int parameter denotes a flags type.

GObject.cclosure_marshal_STRING__OBJECT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type gchar* (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data).

GObject.cclosure_marshal_VOID__BOOLEAN(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gboolean arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__CHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gchar arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__DOUBLE(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gdouble arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__ENUM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gint arg1, gpointer user_data) where the int parameter denotes an enumeration type..

GObject.cclosure_marshal_VOID__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gint arg1, gpointer user_data) where the int parameter denotes a flags type.

GObject.cclosure_marshal_VOID__FLOAT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gfloat arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__INT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gint arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__LONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, glong arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__OBJECT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, GObject *arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__PARAM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gpointer arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__STRING(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__UCHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, guchar arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__UINT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, guint arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__UINT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data).

GObject.cclosure_marshal_VOID__ULONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gulong arg1, gpointer user_data).

GObject.cclosure_marshal_VOID__VARIANT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, GVariant *arg1, gpointer user_data).

New in version 2.26.

GObject.cclosure_marshal_VOID__VOID(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A marshaller for a GObject.CClosure with a callback of type void (*callback) (gpointer instance, gpointer user_data).

GObject.cclosure_marshal_generic(closure, return_gvalue, n_param_values, param_values, invocation_hint, marshal_data)
Parameters:

A generic marshaller function implemented via libffi.

Normally this function is not passed explicitly to GObject.signal_new(), but used automatically by GLib when specifying a None marshaller.

New in version 2.30.

GObject.clear_signal_handler(handler_id_ptr, instance)
Parameters:
  • handler_id_ptr (int) – A pointer to a handler ID (of type int) of the handler to be disconnected.

  • instance (GObject.Object) – The instance to remove the signal handler from. This pointer may be None or invalid, if the handler ID is zero.

Disconnects a handler from instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to. The handler_id_ptr is then set to zero, which is never a valid handler ID value (see g_signal_connect()).

If the handler ID is 0 then this function does nothing.

There is also a macro version of this function so that the code will be inlined.

New in version 2.62.

GObject.enum_complete_type_info(g_enum_type, const_values)
Parameters:
  • g_enum_type (GObject.GType) – the type identifier of the type being completed

  • const_values (GObject.EnumValue) – An array of GObject.EnumValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.

Returns:

the GObject.TypeInfo struct to be filled in

Return type:

info: GObject.TypeInfo

This function is meant to be called from the complete_type_info function of a GObject.TypePlugin implementation, as in the following example:

static void
my_enum_complete_type_info (GTypePlugin     *plugin,
                            GType            g_type,
                            GTypeInfo       *info,
                            GTypeValueTable *value_table)
{
  static const GEnumValue values[] = {
    { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
    { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
    { 0, NULL, NULL }
  };

  g_enum_complete_type_info (type, info, values);
}
GObject.enum_get_value(enum_class, value)
Parameters:
Returns:

the GObject.EnumValue for value, or None if value is not a member of the enumeration

Return type:

GObject.EnumValue or None

Returns the GObject.EnumValue for a value.

GObject.enum_get_value_by_name(enum_class, name)
Parameters:
Returns:

the GObject.EnumValue with name name, or None if the enumeration doesn’t have a member with that name

Return type:

GObject.EnumValue or None

Looks up a GObject.EnumValue by name.

GObject.enum_get_value_by_nick(enum_class, nick)
Parameters:
Returns:

the GObject.EnumValue with nickname nick, or None if the enumeration doesn’t have a member with that nickname

Return type:

GObject.EnumValue or None

Looks up a GObject.EnumValue by nickname.

GObject.enum_register_static(name, const_static_values)
Parameters:
  • name (str) – A nul-terminated string used as the name of the new type.

  • const_static_values (GObject.EnumValue) – An array of GObject.EnumValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0. GObject.Object keeps a reference to the data, so it cannot be stack-allocated.

Returns:

The new type identifier.

Return type:

GObject.GType

Registers a new static enumeration type with the name name.

It is normally more convenient to let glib-mkenums, generate a my_enum_get_type() function from a usual C enumeration definition than to write one yourself using GObject.enum_register_static().

GObject.enum_to_string(g_enum_type, value)
Parameters:
Returns:

a newly-allocated text string

Return type:

str

Pretty-prints value in the form of the enum’s name.

This is intended to be used for debugging purposes. The format of the output may change in the future.

New in version 2.54.

GObject.flags_complete_type_info(g_flags_type, const_values)
Parameters:
  • g_flags_type (GObject.GType) – the type identifier of the type being completed

  • const_values (GObject.FlagsValue) – An array of GObject.FlagsValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.

Returns:

the GObject.TypeInfo struct to be filled in

Return type:

info: GObject.TypeInfo

This function is meant to be called from the complete_type_info() function of a GObject.TypePlugin implementation, see the example for GObject.enum_complete_type_info() above.

GObject.flags_get_first_value(flags_class, value)
Parameters:
Returns:

the first GObject.FlagsValue which is set in value, or None if none is set

Return type:

GObject.FlagsValue or None

Returns the first GObject.FlagsValue which is set in value.

GObject.flags_get_value_by_name(flags_class, name)
Parameters:
Returns:

the GObject.FlagsValue with name name, or None if there is no flag with that name

Return type:

GObject.FlagsValue or None

Looks up a GObject.FlagsValue by name.

GObject.flags_get_value_by_nick(flags_class, nick)
Parameters:
Returns:

the GObject.FlagsValue with nickname nick, or None if there is no flag with that nickname

Return type:

GObject.FlagsValue or None

Looks up a GObject.FlagsValue by nickname.

GObject.flags_register_static(name, const_static_values)
Parameters:
  • name (str) – A nul-terminated string used as the name of the new type.

  • const_static_values (GObject.FlagsValue) – An array of GObject.FlagsValue structs for the possible flags values. The array is terminated by a struct with all members being 0. GObject.Object keeps a reference to the data, so it cannot be stack-allocated.

Returns:

The new type identifier.

Return type:

GObject.GType

Registers a new static flags type with the name name.

It is normally more convenient to let glib-mkenums generate a my_flags_get_type() function from a usual C enumeration definition than to write one yourself using GObject.flags_register_static().

GObject.flags_to_string(flags_type, value)
Parameters:
Returns:

a newly-allocated text string

Return type:

str

Pretty-prints value in the form of the flag names separated by `` | `` and sorted. Any extra bits will be shown at the end as a hexadecimal number.

This is intended to be used for debugging purposes. The format of the output may change in the future.

New in version 2.54.

GObject.gtype_get_type()
Return type:

GObject.GType

GObject.list_properties(type)
Parameters:

type (GObject.Object) – a Python GObject instance or type that the signal is associated with

Returns:

a list of GObject.ParamSpec

Return type:

[GObject.ParamSpec]

Takes a GObject/GInterface subclass or a GType and returns a list of GParamSpecs for all properties of type.

GObject.new(gtype_or_similar, **kwargs)
Parameters:
  • type (GObject.Object) – a Python GObject type

  • kwargs – set of property-value pairs

Returns:

a new object of the specified type

The Gobject.new() function returns a new object of the specified type. type must specify a type that is a descendant of gobject.GObject. GObject properties can set via keyword arguments.

GObject.param_spec_boolean(name, nick, blurb, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • default_value (bool) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecBoolean instance specifying a GObject.TYPE_BOOLEAN property. In many cases, it may be more appropriate to use an enum with GObject.param_spec_enum(), both to improve code clarity by using explicitly named values, and to allow for more values to be added in future without breaking API.

See g_param_spec_internal() for details on property names.

GObject.param_spec_boxed(name, nick, blurb, boxed_type, flags)
Parameters:
Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecBoxed instance specifying a GObject.TYPE_BOXED derived property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_char(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecChar instance specifying a GObject.TYPE_CHAR property.

GObject.param_spec_double(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (float) – minimum value for the property specified

  • maximum (float) – maximum value for the property specified

  • default_value (float) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecDouble instance specifying a GObject.TYPE_DOUBLE property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_enum(name, nick, blurb, enum_type, default_value, flags)
Parameters:
Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecEnum instance specifying a GObject.TYPE_ENUM property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_flags(name, nick, blurb, flags_type, default_value, flags)
Parameters:
Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecFlags instance specifying a GObject.TYPE_FLAGS property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_float(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (float) – minimum value for the property specified

  • maximum (float) – maximum value for the property specified

  • default_value (float) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecFloat instance specifying a GObject.TYPE_FLOAT property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_gtype(name, nick, blurb, is_a_type, flags)
Parameters:
Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecGType instance specifying a GObject.TYPE_GTYPE property.

See g_param_spec_internal() for details on property names.

New in version 2.10.

GObject.param_spec_int(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecInt instance specifying a GObject.TYPE_INT property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_int64(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecInt64 instance specifying a GObject.TYPE_INT64 property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_long(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecLong instance specifying a GObject.TYPE_LONG property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_object(name, nick, blurb, object_type, flags)
Parameters:
Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecBoxed instance specifying a GObject.TYPE_OBJECT derived property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_param(name, nick, blurb, param_type, flags)
Parameters:
Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecParam instance specifying a GObject.TYPE_PARAM property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_pointer(name, nick, blurb, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecPointer instance specifying a pointer property. Where possible, it is better to use GObject.param_spec_object() or GObject.param_spec_boxed() to expose memory management information.

See g_param_spec_internal() for details on property names.

GObject.param_spec_string(name, nick, blurb, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • default_value (str or None) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecString instance.

See g_param_spec_internal() for details on property names.

GObject.param_spec_uchar(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecUChar instance specifying a GObject.TYPE_UCHAR property.

GObject.param_spec_uint(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecUInt instance specifying a GObject.TYPE_UINT property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_uint64(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecUInt64 instance specifying a GObject.TYPE_UINT64 property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_ulong(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • minimum (int) – minimum value for the property specified

  • maximum (int) – maximum value for the property specified

  • default_value (int) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecULong instance specifying a GObject.TYPE_ULONG property.

See g_param_spec_internal() for details on property names.

GObject.param_spec_unichar(name, nick, blurb, default_value, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • default_value (str) – default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecUnichar instance specifying a GObject.TYPE_UINT property. GObject.Value structures for this property can be accessed with GObject.Value.set_uint() and GObject.Value.get_uint().

See g_param_spec_internal() for details on property names.

GObject.param_spec_variant(name, nick, blurb, type, default_value, flags)
Parameters:
Returns:

the newly created GObject.ParamSpec

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpecVariant instance specifying a GLib.Variant property.

If default_value is floating, it is consumed.

See g_param_spec_internal() for details on property names.

New in version 2.26.

GObject.param_type_register_static(name, pspec_info)
Parameters:
Returns:

The new type identifier.

Return type:

GObject.GType

Registers name as the name of a new static type derived from GObject.TYPE_PARAM.

The type system uses the information contained in the GObject.ParamSpecTypeInfo structure pointed to by info to manage the GObject.ParamSpec type and its instances.

GObject.param_value_convert(pspec, src_value, dest_value, strict_validation)
Parameters:
Returns:

True if transformation and validation were successful, False otherwise and dest_value is left untouched.

Return type:

bool

Transforms src_value into dest_value if possible, and then validates dest_value, in order for it to conform to pspec. If strict_validation is True this function will only succeed if the transformed dest_value complied to pspec without modifications.

See also GObject.Value.type_transformable(), GObject.Value.transform() and GObject.param_value_validate().

GObject.param_value_defaults(pspec, value)
Parameters:
Returns:

whether value contains the canonical default for this pspec

Return type:

bool

Checks whether value contains the default value as specified in pspec.

GObject.param_value_is_valid(pspec, value)
Parameters:
Returns:

whether the contents of value comply with the specifications set out by pspec.

Return type:

bool

Return whether the contents of value comply with the specifications set out by pspec.

New in version 2.74.

GObject.param_value_set_default(pspec, value)
Parameters:

Sets value to its default value as specified in pspec.

GObject.param_value_validate(pspec, value)
Parameters:
Returns:

whether modifying value was necessary to ensure validity

Return type:

bool

Ensures that the contents of value comply with the specifications set out by pspec. For example, a GObject.ParamSpecInt might require that integers stored in value may not be smaller than -42 and not be greater than +42. If value contains an integer outside of this range, it is modified accordingly, so the resulting value will fit into the range -42 .. +42.

GObject.param_values_cmp(pspec, value1, value2)
Parameters:
Returns:

-1, 0 or +1, for a less than, equal to or greater than result

Return type:

int

Compares value1 with value2 according to pspec, and return -1, 0 or +1, if value1 is found to be less than, equal to or greater than value2, respectively.

GObject.pointer_type_register_static(name)
Parameters:

name (str) – the name of the new pointer type.

Returns:

a new GObject.TYPE_POINTER derived type id for name.

Return type:

GObject.GType

Creates a new GObject.TYPE_POINTER derived type id for a new pointer type with name name.

GObject.remove_emission_hook(obj, detailed_signal, hook_id)
GObject.signal_accumulator_first_wins(ihint, return_accu, handler_return, dummy)
Parameters:
Returns:

standard GObject.SignalAccumulator result

Return type:

bool

A predefined GObject.SignalAccumulator for signals intended to be used as a hook for application code to provide a particular value. Usually only one such value is desired and multiple handlers for the same signal don’t make much sense (except for the case of the default handler defined in the class structure, in which case you will usually want the signal connection to override the class handler).

This accumulator will use the return value from the first signal handler that is run as the return value for the signal and not run any further handlers (ie: the first handler “wins”).

New in version 2.28.

GObject.signal_accumulator_true_handled(ihint, return_accu, handler_return, dummy)
Parameters:
Returns:

standard GObject.SignalAccumulator result

Return type:

bool

A predefined GObject.SignalAccumulator for signals that return a boolean values. The behavior that this accumulator gives is that a return of True stops the signal emission: no further callbacks will be invoked, while a return of False allows the emission to continue. The idea here is that a True return indicates that the callback handled the signal, and no further handling is needed.

New in version 2.4.

GObject.signal_add_emission_hook(signal_id, detail, hook_func)
Parameters:
Returns:

the hook id, for later use with GObject.signal_remove_emission_hook().

Return type:

int

Adds an emission hook for a signal, which will get called for any emission of that signal, independent of the instance. This is possible only for signals which don’t have GObject.SignalFlags.NO_HOOKS flag set.

GObject.signal_chain_from_overridden(instance_and_params, return_value)
Parameters:
  • instance_and_params ([GObject.Value]) – the argument list of the signal emission. The first element in the array is a GObject.Value for the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.

  • return_value (GObject.Value) – Location for the return value.

Calls the original class closure of a signal. This function should only be called from an overridden class closure; see GObject.signal_override_class_closure() and g_signal_override_class_handler().

GObject.signal_connect_closure(instance, detailed_signal, closure, after)
Parameters:
  • instance (GObject.Object) – the instance to connect to.

  • detailed_signal (str) – a string of the form “signal-name::detail”.

  • closure (GObject.Closure) – the closure to connect.

  • after (bool) – whether the handler should be called before or after the default handler of the signal.

Returns:

the handler ID (always greater than 0 for successful connections)

Return type:

int

Connects a closure to a signal for a particular object.

If closure is a floating reference (see GObject.Closure.sink()), this function takes ownership of closure.

GObject.signal_connect_closure_by_id(instance, signal_id, detail, closure, after)
Parameters:
  • instance (GObject.Object) – the instance to connect to.

  • signal_id (int) – the id of the signal.

  • detail (int) – the detail.

  • closure (GObject.Closure) – the closure to connect.

  • after (bool) – whether the handler should be called before or after the default handler of the signal.

Returns:

the handler ID (always greater than 0 for successful connections)

Return type:

int

Connects a closure to a signal for a particular object.

If closure is a floating reference (see GObject.Closure.sink()), this function takes ownership of closure.

GObject.signal_emitv(instance_and_params, signal_id, detail, return_value)
Parameters:
  • instance_and_params ([GObject.Value]) – argument list for the signal emission. The first element in the array is a GObject.Value for the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.

  • signal_id (int) – the signal id

  • detail (int) – the detail

  • return_value (GObject.Value) – Location to store the return value of the signal emission. This must be provided if the specified signal returns a value, but may be ignored otherwise.

Returns:

Location to store the return value of the signal emission. This must be provided if the specified signal returns a value, but may be ignored otherwise.

Return type:

return_value: GObject.Value

Emits a signal. Signal emission is done synchronously. The method will only return control after all handlers are called or signal emission was stopped.

Note that GObject.signal_emitv() doesn’t change return_value if no handlers are connected, in contrast to g_signal_emit() and g_signal_emit_valist().

GObject.signal_get_invocation_hint(instance)
Parameters:

instance (GObject.Object) – the instance to query

Returns:

the invocation hint of the innermost signal emission, or None if not found.

Return type:

GObject.SignalInvocationHint or None

Returns the invocation hint of the innermost signal emission of instance.

GObject.signal_handler_block(instance, handler_id)

Blocks the signal handler from being invoked until handler_unblock() is called.

Parameters:
  • obj (GObject.Object) – Object instance to block handlers for.

  • handler_id (int) – Id of signal to block.

Returns:

A context manager which optionally can be used to automatically unblock the handler:

with GObject.signal_handler_block(obj, id):
    pass
GObject.signal_handler_disconnect(instance, handler_id)
Parameters:
  • instance (GObject.Object) – The instance to remove the signal handler from.

  • handler_id (int) – Handler id of the handler to be disconnected.

Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to. The handler_id becomes invalid and may be reused.

The handler_id has to be a valid signal handler id, connected to a signal of instance.

GObject.signal_handler_find(instance, mask, signal_id, detail, closure, func, data)
Parameters:
  • instance (GObject.Object) – The instance owning the signal handler to be found.

  • mask (GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handler has to match.

  • signal_id (int) – Signal the handler has to be connected to.

  • detail (int) – Signal detail the handler has to be connected to.

  • closure (GObject.Closure or None) – The closure the handler will invoke.

  • func (object or None) – The C closure callback of the handler (useless for non-C closures).

  • data (object or None) – The closure data of the handler’s closure.

Returns:

A valid non-0 signal handler id for a successful match.

Return type:

int

Finds the first signal handler that matches certain selection criteria. The criteria mask is passed as an OR-ed combination of GObject.SignalMatchType flags, and the criteria values are passed as arguments. The match mask has to be non-0 for successful matches. If no handler was found, 0 is returned.

GObject.signal_handler_is_connected(instance, handler_id)
Parameters:
  • instance (GObject.Object) – The instance where a signal handler is sought.

  • handler_id (int) – the handler ID.

Returns:

whether handler_id identifies a handler connected to instance.

Return type:

bool

Returns whether handler_id is the ID of a handler connected to instance.

GObject.signal_handler_unblock(instance, handler_id)
Parameters:
  • instance (GObject.Object) – The instance to unblock the signal handler of.

  • handler_id (int) – Handler id of the handler to be unblocked.

Undoes the effect of a previous GObject.signal_handler_block() call. A blocked handler is skipped during signal emissions and will not be invoked, unblocking it (for exactly the amount of times it has been blocked before) reverts its “blocked” state, so the handler will be recognized by the signal system and is called upon future or currently ongoing signal emissions (since the order in which handlers are called during signal emissions is deterministic, whether the unblocked handler in question is called as part of a currently ongoing emission depends on how far that emission has proceeded yet).

The handler_id has to be a valid id of a signal handler that is connected to a signal of instance and is currently blocked.

GObject.signal_handlers_block_matched(instance, mask, signal_id, detail, closure, func, data)
Parameters:
  • instance (GObject.Object) – The instance to block handlers from.

  • mask (GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handlers have to match.

  • signal_id (int) – Signal the handlers have to be connected to.

  • detail (int) – Signal detail the handlers have to be connected to.

  • closure (GObject.Closure or None) – The closure the handlers will invoke.

  • func (object or None) – The C closure callback of the handlers (useless for non-C closures).

  • data (object or None) – The closure data of the handlers’ closures.

Returns:

The number of handlers that matched.

Return type:

int

Blocks all handlers on an instance that match a certain selection criteria.

The criteria mask is passed as a combination of GObject.SignalMatchType flags, and the criteria values are passed as arguments. A handler must match on all flags set in mask to be blocked (i.e. the match is conjunctive).

Passing at least one of the GObject.SignalMatchType.ID, GObject.SignalMatchType.CLOSURE, GObject.SignalMatchType.FUNC or GObject.SignalMatchType.DATA match flags is required for successful matches. If no handlers were found, 0 is returned, the number of blocked handlers otherwise.

Support for GObject.SignalMatchType.ID was added in GLib 2.78.

GObject.signal_handlers_destroy(instance)
Parameters:

instance (GObject.Object) – The instance whose signal handlers are destroyed

Destroy all signal handlers of a type instance. This function is an implementation detail of the GObject.Object dispose implementation, and should not be used outside of the type system.

GObject.signal_handlers_disconnect_matched(instance, mask, signal_id, detail, closure, func, data)
Parameters:
  • instance (GObject.Object) – The instance to remove handlers from.

  • mask (GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handlers have to match.

  • signal_id (int) – Signal the handlers have to be connected to.

  • detail (int) – Signal detail the handlers have to be connected to.

  • closure (GObject.Closure or None) – The closure the handlers will invoke.

  • func (object or None) – The C closure callback of the handlers (useless for non-C closures).

  • data (object or None) – The closure data of the handlers’ closures.

Returns:

The number of handlers that matched.

Return type:

int

Disconnects all handlers on an instance that match a certain selection criteria.

The criteria mask is passed as a combination of GObject.SignalMatchType flags, and the criteria values are passed as arguments. A handler must match on all flags set in mask to be disconnected (i.e. the match is conjunctive).

Passing at least one of the GObject.SignalMatchType.ID, GObject.SignalMatchType.CLOSURE, GObject.SignalMatchType.FUNC or GObject.SignalMatchType.DATA match flags is required for successful matches. If no handlers were found, 0 is returned, the number of disconnected handlers otherwise.

Support for GObject.SignalMatchType.ID was added in GLib 2.78.

GObject.signal_handlers_unblock_matched(instance, mask, signal_id, detail, closure, func, data)
Parameters:
  • instance (GObject.Object) – The instance to unblock handlers from.

  • mask (GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handlers have to match.

  • signal_id (int) – Signal the handlers have to be connected to.

  • detail (int) – Signal detail the handlers have to be connected to.

  • closure (GObject.Closure or None) – The closure the handlers will invoke.

  • func (object or None) – The C closure callback of the handlers (useless for non-C closures).

  • data (object or None) – The closure data of the handlers’ closures.

Returns:

The number of handlers that matched.

Return type:

int

Unblocks all handlers on an instance that match a certain selection criteria.

The criteria mask is passed as a combination of GObject.SignalMatchType flags, and the criteria values are passed as arguments. A handler must match on all flags set in mask to be unblocked (i.e. the match is conjunctive).

Passing at least one of the GObject.SignalMatchType.ID, GObject.SignalMatchType.CLOSURE, GObject.SignalMatchType.FUNC or GObject.SignalMatchType.DATA match flags is required for successful matches. If no handlers were found, 0 is returned, the number of unblocked handlers otherwise. The match criteria should not apply to any handlers that are not currently blocked.

Support for GObject.SignalMatchType.ID was added in GLib 2.78.

GObject.signal_has_handler_pending(instance, signal_id, detail, may_be_blocked)
Parameters:
  • instance (GObject.Object) – the object whose signal handlers are sought.

  • signal_id (int) – the signal id.

  • detail (int) – the detail.

  • may_be_blocked (bool) – whether blocked handlers should count as match.

Returns:

True if a handler is connected to the signal, False otherwise.

Return type:

bool

Returns whether there are any handlers connected to instance for the given signal id and detail.

If detail is 0 then it will only match handlers that were connected without detail. If detail is non-zero then it will match handlers connected both without detail and with the given detail. This is consistent with how a signal emitted with detail would be delivered to those handlers.

Since 2.46 this also checks for a non-default class closure being installed, as this is basically always what you want.

One example of when you might use this is when the arguments to the signal are difficult to compute. A class implementor may opt to not emit the signal if no one is attached anyway, thus saving the cost of building the arguments.

GObject.signal_is_valid_name(name)
Parameters:

name (str) – the canonical name of the signal

Returns:

True if name is a valid signal name, False otherwise.

Return type:

bool

Validate a signal name. This can be useful for dynamically-generated signals which need to be validated at run-time before actually trying to create them.

See canonical parameter names for details of the rules for valid names. The rules for signal names are the same as those for property names.

New in version 2.66.

GObject.signal_list_ids(itype)
Parameters:

itype (GObject.GType) – Instance or interface type.

Returns:

Newly allocated array of signal IDs.

Return type:

[int]

Lists the signals by id that a certain instance or interface type created. Further information about the signals can be acquired through GObject.signal_query().

GObject.signal_list_names(type_)

Returns a list of signal names for the given type

Parameters:

type_ (GObject.GType) –

Returns:

A list of signal names

Return type:

list

GObject.signal_lookup(name, itype)
Parameters:
  • name (str) – the signal’s name.

  • itype (GObject.GType) – the type that the signal operates on.

Returns:

the signal’s identifying number, or 0 if no signal was found.

Return type:

int

Given the name of the signal and the type of object it connects to, gets the signal’s identifying integer. Emitting the signal by number is somewhat faster than using the name each time.

Also tries the ancestors of the given type.

The type class passed as itype must already have been instantiated (for example, using GObject.TypeClass.ref()) for this function to work, as signals are always installed during class initialization.

See GObject.signal_new() for details on allowed signal names.

GObject.signal_name(signal_id)
Parameters:

signal_id (int) – the signal’s identifying number.

Returns:

the signal name, or None if the signal number was invalid.

Return type:

str or None

Given the signal’s identifier, finds its name.

Two different signals may have the same name, if they have differing types.

GObject.signal_new(signal_name, type, flags, return_type, param_types)
Parameters:
  • signal_name (str) – the name of the signal

  • type (GObject.Object) – a Python GObject instance or type that the signal is associated with

  • flags (GObject.SignalFlags) – the signal flags

  • return_type (type) – the return type of the signal handler

  • param_types ([type]) – the parameter types passed to the signal handler

Returns:

a unique integer signal ID

Return type:

int

The GObject.signal_new() function registers a signal with the specified signal_name for the specified object type.

return_type is the type of the return value from a signal handler and may be a gobject type, type ID or instance. The param_types parameter is a list of additional types that are passed to the signal handler. Each parameter type may be specified as a gobject type, type ID or instance. For example, to add a signal to the Gtk.Window type called “my-signal” that calls a handler with a Gtk.Button widget and an integer value and a return value that is a boolean, use:

GObject.signal_new("my_signal", Gtk.Window, GObject.SignalFlags.RUN_LAST, GObject.TYPE_BOOLEAN, (Gtk.Button, GObject.TYPE_INT))
GObject.signal_override_class_closure(signal_id, instance_type, class_closure)
Parameters:
  • signal_id (int) – the signal id

  • instance_type (GObject.GType) – the instance type on which to override the class closure for the signal.

  • class_closure (GObject.Closure) – the closure.

Overrides the class closure (i.e. the default handler) for the given signal for emissions on instances of instance_type. instance_type must be derived from the type to which the signal belongs.

See GObject.signal_chain_from_overridden() and g_signal_chain_from_overridden_handler() for how to chain up to the parent class closure from inside the overridden one.

GObject.signal_parse_name(detailed_signal, itype, force_detail_quark)

Parse a detailed signal name into (signal_id, detail).

Parameters:

detailed_signal (str) – Signal name which can include detail. For example: “notify:prop_name”

Returns:

Tuple of (signal_id, detail)

Raises:

ValueError – If the given signal is unknown.

GObject.signal_query(signal_id)
Parameters:

signal_id (int) – The signal id of the signal to query information for.

Returns:

A user provided structure that is filled in with constant values upon success.

Return type:

query: GObject.SignalQuery

Queries the signal system for in-depth information about a specific signal. This function will fill in a user-provided structure to hold signal-specific information. If an invalid signal id is passed in, the signal_id member of the GObject.SignalQuery is 0. All members filled into the GObject.SignalQuery structure should be considered constant and have to be left untouched.

GObject.signal_remove_emission_hook(signal_id, hook_id)
Parameters:

Deletes an emission hook.

GObject.signal_stop_emission(instance, signal_id, detail)
Parameters:
  • instance (GObject.Object) – the object whose signal handlers you wish to stop.

  • signal_id (int) – the signal identifier, as returned by GObject.signal_lookup().

  • detail (int) – the detail which the signal was emitted with.

Stops a signal’s current emission.

This will prevent the default method from running, if the signal was GObject.SignalFlags.RUN_LAST and you connected normally (i.e. without the “after” flag).

Prints a warning if used on a signal which isn’t being emitted.

GObject.signal_stop_emission_by_name(instance, detailed_signal)
Parameters:
  • instance (GObject.Object) – the object whose signal handlers you wish to stop.

  • detailed_signal (str) – a string of the form “signal-name::detail”.

Stops a signal’s current emission.

This is just like GObject.signal_stop_emission() except it will look up the signal id for you.

GObject.signal_type_cclosure_new(itype, struct_offset)
Parameters:
  • itype (GObject.GType) – the GObject.GType identifier of an interface or classed type

  • struct_offset (int) – the offset of the member function of itype's class structure which is to be invoked by the new closure

Returns:

a floating reference to a new GObject.CClosure

Return type:

GObject.Closure

Creates a new closure which invokes the function found at the offset struct_offset in the class structure of the interface or classed type identified by itype.

GObject.source_set_closure(source, closure)
Parameters:

Set the callback for a source as a GObject.Closure.

If the source is not one of the standard GLib types, the closure_callback and closure_marshal fields of the GLib.SourceFuncs structure must have been filled in with pointers to appropriate functions.

GObject.source_set_dummy_callback(source)
Parameters:

source (GLib.Source) – the source

Sets a dummy callback for source. The callback will do nothing, and if the source expects a bool return value, it will return True. (If the source expects any other type of return value, it will return a 0/None value; whatever GObject.Value.init() initializes a GObject.Value to for that type.)

If the source is not one of the standard GLib types, the closure_callback and closure_marshal fields of the GLib.SourceFuncs structure must have been filled in with pointers to appropriate functions.

GObject.strdup_value_contents(value)
Parameters:

value (GObject.Value) – GObject.Value which contents are to be described.

Returns:

Newly allocated string.

Return type:

str

Return a newly allocated string, which describes the contents of a GObject.Value. The main purpose of this function is to describe GObject.Value contents for debugging output, the way in which the contents are described may change between different GLib versions.

GObject.type_add_class_private(class_type, private_size)
Parameters:

Registers a private class structure for a classed type; when the class is allocated, the private structures for the class and all of its parent types are allocated sequentially in the same memory block as the public structures, and are zero-filled.

This function should be called in the type’s get_type() function after the type is registered. The private structure can be retrieved using the G_TYPE_CLASS_GET_PRIVATE() macro.

New in version 2.24.

GObject.type_add_instance_private(class_type, private_size)
Parameters:
Return type:

int

GObject.type_add_interface_dynamic(instance_type, interface_type, plugin)
Parameters:

Adds interface_type to the dynamic instance_type. The information contained in the GObject.TypePlugin structure pointed to by plugin is used to manage the relationship.

GObject.type_add_interface_static(instance_type, interface_type, info)
Parameters:

Adds interface_type to the static instance_type. The information contained in the GObject.InterfaceInfo structure pointed to by info is used to manage the relationship.

GObject.type_check_class_is_a(g_class, is_a_type)
Parameters:
Return type:

bool

GObject.type_check_instance(instance)
Parameters:

instance (GObject.TypeInstance) – a valid GObject.TypeInstance structure

Returns:

True if instance is valid, False otherwise

Return type:

bool

Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE() macro.

GObject.type_check_instance_is_a(instance, iface_type)
Parameters:
Return type:

bool

GObject.type_check_instance_is_fundamentally_a(instance, fundamental_type)
Parameters:
Return type:

bool

GObject.type_check_is_value_type(type)
Parameters:

type (GObject.GType) –

Return type:

bool

GObject.type_check_value(value)
Parameters:

value (GObject.Value) –

Return type:

bool

GObject.type_check_value_holds(value, type)
Parameters:
Return type:

bool

GObject.type_children(type)
Parameters:

type (GObject.GType) – the parent type

Returns:

Newly allocated and 0-terminated array of child types, free with GLib.free()

Return type:

[GObject.GType]

Return a newly allocated and 0-terminated array of type IDs, listing the child types of type.

GObject.type_class_adjust_private_offset(g_class, private_size_or_offset)
Parameters:
GObject.type_class_peek(type)
Parameters:

type (GObject.GType) – type ID of a classed type

Returns:

the GObject.TypeClass structure for the given type ID or None if the class does not currently exist

Return type:

GObject.TypeClass

This function is essentially the same as GObject.TypeClass.ref(), except that the classes reference count isn’t incremented. As a consequence, this function may return None if the class of the type passed in does not currently exist (hasn’t been referenced before).

GObject.type_class_peek_static(type)
Parameters:

type (GObject.GType) – type ID of a classed type

Returns:

the GObject.TypeClass structure for the given type ID or None if the class does not currently exist or is dynamically loaded

Return type:

GObject.TypeClass

A more efficient version of GObject.TypeClass.peek() which works only for static types.

New in version 2.4.

GObject.type_class_ref(type)
Parameters:

type (GObject.GType) – type ID of a classed type

Returns:

the GObject.TypeClass structure for the given type ID

Return type:

GObject.TypeClass

Increments the reference count of the class structure belonging to type. This function will demand-create the class if it doesn’t exist already.

GObject.type_default_interface_peek(g_type)
Parameters:

g_type (GObject.GType) – an interface type

Returns:

the default vtable for the interface, or None if the type is not currently in use

Return type:

GObject.TypeInterface

If the interface type g_type is currently in use, returns its default interface vtable.

New in version 2.4.

GObject.type_default_interface_ref(g_type)
Parameters:

g_type (GObject.GType) – an interface type

Returns:

the default vtable for the interface; call GObject.type_default_interface_unref() when you are done using the interface.

Return type:

GObject.TypeInterface

Increments the reference count for the interface type g_type, and returns the default interface vtable for the type.

If the type is not currently in use, then the default vtable for the type will be created and initialized by calling the base interface init and default vtable init functions for the type (the base_init and class_init members of GObject.TypeInfo). Calling GObject.type_default_interface_ref() is useful when you want to make sure that signals and properties for an interface have been installed.

New in version 2.4.

GObject.type_default_interface_unref(g_iface)
Parameters:

g_iface (GObject.TypeInterface) – the default vtable structure for an interface, as returned by GObject.type_default_interface_ref()

Decrements the reference count for the type corresponding to the interface default vtable g_iface. If the type is dynamic, then when no one is using the interface and all references have been released, the finalize function for the interface’s default vtable (the class_finalize member of GObject.TypeInfo) will be called.

New in version 2.4.

GObject.type_depth(type)
Parameters:

type (GObject.GType) – a GObject.GType

Returns:

the depth of type

Return type:

int

Returns the length of the ancestry of the passed in type. This includes the type itself, so that e.g. a fundamental type has depth 1.

GObject.type_ensure(type)
Parameters:

type (GObject.GType) – a GObject.GType

Ensures that the indicated type has been registered with the type system, and its _class_init() method has been run.

In theory, simply calling the type’s _get_type() method (or using the corresponding macro) is supposed take care of this. However, _get_type() methods are often marked %G_GNUC_CONST for performance reasons, even though this is technically incorrect (since %G_GNUC_CONST requires that the function not have side effects, which _get_type() methods do on the first call). As a result, if you write a bare call to a _get_type() macro, it may get optimized out by the compiler. Using GObject.type_ensure() guarantees that the type’s _get_type() method is called.

New in version 2.34.

GObject.type_free_instance(instance)
Parameters:

instance (GObject.TypeInstance) – an instance of a type

Frees an instance of a type, returning it to the instance pool for the type, if there is one.

Like g_type_create_instance(), this function is reserved for implementors of fundamental types.

GObject.type_from_name(name)
Parameters:

name (str) – type name to look up

Returns:

corresponding type ID or 0

Return type:

GObject.GType

Look up the type ID from a given type name, returning 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).

GObject.type_fundamental(type_id)
Parameters:

type_id (GObject.GType) – valid type ID

Returns:

fundamental type ID

Return type:

GObject.GType

Internal function, used to extract the fundamental type ID portion. Use G_TYPE_FUNDAMENTAL() instead.

GObject.type_fundamental_next()
Returns:

the next available fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs

Return type:

GObject.GType

Returns the next free fundamental type id which can be used to register a new fundamental type with GObject.type_register_fundamental(). The returned type ID represents the highest currently registered fundamental type identifier.

GObject.type_get_instance_count(type)
Parameters:

type (GObject.GType) – a GObject.GType

Returns:

the number of instances allocated of the given type; if instance counts are not available, returns 0.

Return type:

int

Returns the number of instances allocated of the particular type; this is only available if GLib is built with debugging support and the instance-count debug flag is set (by setting the GOBJECT_DEBUG variable to include instance-count).

New in version 2.44.

GObject.type_get_plugin(type)
Parameters:

type (GObject.GType) – GObject.GType to retrieve the plugin for

Returns:

the corresponding plugin if type is a dynamic type, None otherwise

Return type:

GObject.TypePlugin

Returns the GObject.TypePlugin structure for type.

GObject.type_get_qdata(type, quark)
Parameters:
Returns:

the data, or None if no data was found

Return type:

object or None

Obtains data which has previously been attached to type with GObject.type_set_qdata().

Note that this does not take subtyping into account; data attached to one type with GObject.type_set_qdata() cannot be retrieved from a subtype using GObject.type_get_qdata().

GObject.type_get_type_registration_serial()
Returns:

An unsigned int, representing the state of type registrations

Return type:

int

Returns an opaque serial number that represents the state of the set of registered types. Any time a type is registered this serial changes, which means you can cache information based on type lookups (such as GObject.type_from_name()) and know if the cache is still valid at a later time by comparing the current serial with the one at the type lookup.

New in version 2.36.

GObject.type_init()

This function used to initialise the type system. Since GLib 2.36, the type system is initialised automatically and this function does nothing.

Deprecated since version 2.36: the type system is now initialised automatically

GObject.type_init_with_debug_flags(debug_flags)
Parameters:

debug_flags (GObject.TypeDebugFlags) – bitwise combination of GObject.TypeDebugFlags values for debugging purposes

This function used to initialise the type system with debugging flags. Since GLib 2.36, the type system is initialised automatically and this function does nothing.

If you need to enable debugging features, use the GOBJECT_DEBUG environment variable.

Deprecated since version 2.36: the type system is now initialised automatically

GObject.type_interface_add_prerequisite(interface_type, prerequisite_type)
Parameters:

Adds prerequisite_type to the list of prerequisites of interface_type. This means that any type implementing interface_type must also implement prerequisite_type. Prerequisites can be thought of as an alternative to interface derivation (which GObject.GType doesn’t support). An interface can have at most one instantiatable prerequisite type.

GObject.type_interface_get_plugin(instance_type, interface_type)
Parameters:
Returns:

the GObject.TypePlugin for the dynamic interface interface_type of instance_type

Return type:

GObject.TypePlugin

Returns the GObject.TypePlugin structure for the dynamic interface interface_type which has been added to instance_type, or None if interface_type has not been added to instance_type or does not have a GObject.TypePlugin structure. See GObject.type_add_interface_dynamic().

GObject.type_interface_instantiatable_prerequisite(interface_type)
Parameters:

interface_type (GObject.GType) – an interface type

Returns:

the instantiatable prerequisite type or GObject.TYPE_INVALID if none

Return type:

GObject.GType

Returns the most specific instantiatable prerequisite of an interface type. If the interface type has no instantiatable prerequisite, GObject.TYPE_INVALID is returned.

See GObject.TypeInterface.add_prerequisite() for more information about prerequisites.

New in version 2.68.

GObject.type_interface_peek(instance_class, iface_type)
Parameters:
Returns:

the GObject.TypeInterface structure of iface_type if implemented by instance_class, None otherwise

Return type:

GObject.TypeInterface

Returns the GObject.TypeInterface structure of an interface to which the passed in class conforms.

GObject.type_interface_prerequisites(interface_type)
Parameters:

interface_type (GObject.GType) – an interface type

Returns:

a newly-allocated zero-terminated array of GObject.GType containing the prerequisites of interface_type

Return type:

[GObject.GType]

Returns the prerequisites of an interfaces type.

New in version 2.2.

GObject.type_interfaces(type)
Parameters:

type (GObject.GType) – the type to list interface types for

Returns:

Newly allocated and 0-terminated array of interface types, free with GLib.free()

Return type:

[GObject.GType]

Return a newly allocated and 0-terminated array of type IDs, listing the interface types that type conforms to.

GObject.type_is_a(type, is_a_type)
Parameters:
  • type (GObject.GType) – type to check ancestry for

  • is_a_type (GObject.GType) – possible ancestor of type or interface that type could conform to

Returns:

True if type is a is_a_type

Return type:

bool

If is_a_type is a derivable type, check whether type is a descendant of is_a_type. If is_a_type is an interface, check whether type conforms to it.

GObject.type_name(type)
Parameters:

type (GObject.GType) – type to return name for

Returns:

static type name or None

Return type:

str or None

Get the unique name that is assigned to a type ID. Note that this function (like all other GObject.GType API) cannot cope with invalid type IDs. GObject.TYPE_INVALID may be passed to this function, as may be any other validly registered type ID, but randomized type IDs should not be passed in and will most likely lead to a crash.

GObject.type_name_from_class(g_class)
Parameters:

g_class (GObject.TypeClass) –

Return type:

str

GObject.type_name_from_instance(instance)
Parameters:

instance (GObject.TypeInstance) –

Return type:

str

GObject.type_next_base(leaf_type, root_type)
Parameters:
  • leaf_type (GObject.GType) – descendant of root_type and the type to be returned

  • root_type (GObject.GType) – immediate parent of the returned type

Returns:

immediate child of root_type and ancestor of leaf_type

Return type:

GObject.GType

Given a leaf_type and a root_type which is contained in its ancestry, return the type that root_type is the immediate parent of. In other words, this function determines the type that is derived directly from root_type which is also a base class of leaf_type. Given a root type and a leaf type, this function can be used to determine the types and order in which the leaf type is descended from the root type.

GObject.type_parent(type)
Parameters:

type (GObject.GType) – the derived type

Returns:

the parent type

Return type:

GObject.GType

Return the direct parent type of the passed in type. If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.

GObject.type_qname(type)
Parameters:

type (GObject.GType) – type to return quark of type name for

Returns:

the type names quark or 0

Return type:

int

Get the corresponding quark of the type IDs name.

GObject.type_query(type)
Parameters:

type (GObject.GType) – GObject.GType of a static, classed type

Returns:

a user provided structure that is filled in with constant values upon success

Return type:

query: GObject.TypeQuery

Queries the type system for information about a specific type.

This function will fill in a user-provided structure to hold type-specific information. If an invalid GObject.GType is passed in, the type member of the GObject.TypeQuery is 0. All members filled into the GObject.TypeQuery structure should be considered constant and have to be left untouched.

Since GLib 2.78, this function allows queries on dynamic types. Previously it only supported static types.

GObject.type_register(class_)
Parameters:

class – a Python class that is a descendant of GObject.Object

The GObject.type_register() function registers the specified Python class as a GObject type. class_ must be a descendant of GObject.Object. The function generates a name for the new type.

GObject.type_register_dynamic(parent_type, type_name, plugin, flags)
Parameters:
Returns:

the new type identifier or GObject.TYPE_INVALID if registration failed

Return type:

GObject.GType

Registers type_name as the name of a new dynamic type derived from parent_type. The type system uses the information contained in the GObject.TypePlugin structure pointed to by plugin to manage the type and its instances (if not abstract). The value of flags determines the nature (e.g. abstract or not) of the type.

GObject.type_register_fundamental(type_id, type_name, info, finfo, flags)
Parameters:
Returns:

the predefined type identifier

Return type:

GObject.GType

Registers type_id as the predefined identifier and type_name as the name of a fundamental type. If type_id is already registered, or a type named type_name is already registered, the behaviour is undefined. The type system uses the information contained in the GObject.TypeInfo structure pointed to by info and the GObject.TypeFundamentalInfo structure pointed to by finfo to manage the type and its instances. The value of flags determines additional characteristics of the fundamental type.

GObject.type_register_static(parent_type, type_name, info, flags)
Parameters:
Returns:

the new type identifier

Return type:

GObject.GType

Registers type_name as the name of a new static type derived from parent_type. The type system uses the information contained in the GObject.TypeInfo structure pointed to by info to manage the type and its instances (if not abstract). The value of flags determines the nature (e.g. abstract or not) of the type.

GObject.type_set_qdata(type, quark, data)
Parameters:

Attaches arbitrary data to a type.

GObject.type_test_flags(type, flags)
Parameters:
Return type:

bool

GObject.value_type_compatible(src_type, dest_type)
Parameters:
Returns:

True if GObject.Value.copy() is possible with src_type and dest_type.

Return type:

bool

Returns whether a GObject.Value of type src_type can be copied into a GObject.Value of type dest_type.

GObject.value_type_transformable(src_type, dest_type)
Parameters:
Returns:

True if the transformation is possible, False otherwise.

Return type:

bool

Check whether GObject.Value.transform() is able to transform values of type src_type into values of type dest_type. Note that for the types to be transformable, they must be compatible or a transformation function must be registered.