Functions

accelerator_get_default_mod_mask ()

accelerator_get_label (accelerator_key, accelerator_mods)

accelerator_get_label_with_keycode (display, accelerator_key, keycode, accelerator_mods)

accelerator_name (accelerator_key, accelerator_mods)

accelerator_name_with_keycode (display, accelerator_key, keycode, accelerator_mods)

accelerator_parse (accelerator)

accelerator_parse_with_keycode (accelerator, display)

accelerator_valid (keyval, modifiers)

accessible_property_init_value (property, value)

accessible_relation_init_value (relation, value)

accessible_state_init_value (state, value)

bitset_iter_init_at (set, target)

bitset_iter_init_first (set)

bitset_iter_init_last (set)

builder_error_quark ()

check_version (required_major, required_minor, required_micro)

constraint_vfl_parser_error_quark ()

css_parser_error_quark ()

css_parser_warning_quark ()

dialog_error_quark ()

disable_setlocale ()

distribute_natural_allocation (extra_space, sizes)

editable_delegate_get_property (object, prop_id, value, pspec)

editable_delegate_set_property (object, prop_id, value, pspec)

editable_install_properties (object_class, first_prop)

enumerate_printers (func, data, wait)

file_chooser_error_quark ()

get_binary_age ()

get_debug_flags ()

get_default_language ()

get_interface_age ()

get_locale_direction ()

get_major_version ()

get_micro_version ()

get_minor_version ()

hsv_to_rgb (h, s, v)

icon_theme_error_quark ()

init ()

init_check ()

is_initialized ()

native_get_for_surface (surface)

paper_size_get_default ()

paper_size_get_paper_sizes (include_custom)

param_spec_expression (name, nick, blurb, flags)

print_error_quark ()

print_run_page_setup_dialog (parent, page_setup, settings)

print_run_page_setup_dialog_async (parent, page_setup, settings, done_cb, *data)

recent_manager_error_quark ()

render_activity (context, cr, x, y, width, height)

render_arrow (context, cr, angle, x, y, size)

render_background (context, cr, x, y, width, height)

render_check (context, cr, x, y, width, height)

render_expander (context, cr, x, y, width, height)

render_focus (context, cr, x, y, width, height)

render_frame (context, cr, x, y, width, height)

render_handle (context, cr, x, y, width, height)

render_icon (context, cr, texture, x, y)

render_layout (context, cr, x, y, layout)

render_line (context, cr, x0, y0, x1, y1)

render_option (context, cr, x, y, width, height)

rgb_to_hsv (r, g, b)

set_debug_flags (flags)

show_uri (parent, uri, timestamp)

show_uri_full (parent, uri, timestamp, cancellable, callback, *user_data)

show_uri_full_finish (parent, result)

test_accessible_assertion_message_role (domain, file, line, func, expr, accessible, expected_role, actual_role)

test_accessible_has_property (accessible, property)

test_accessible_has_relation (accessible, relation)

test_accessible_has_role (accessible, role)

test_accessible_has_state (accessible, state)

test_list_all_types ()

test_register_all_types ()

test_widget_wait_for_draw (widget)

tree_create_row_drag_content (tree_model, path)

tree_get_row_drag_data (value)

tree_row_reference_deleted (proxy, path)

tree_row_reference_inserted (proxy, path)

value_dup_expression (value)

value_get_expression (value)

value_set_expression (value, expression)

value_take_expression (value, expression)

Details

Gtk.accelerator_get_default_mod_mask()[source]
Returns:

the modifier mask for accelerators

Return type:

Gdk.ModifierType

Gets the modifier mask.

The modifier mask determines which modifiers are considered significant for keyboard accelerators. This includes all keyboard modifiers except for Gdk.ModifierType.LOCK_MASK.

Gtk.accelerator_get_label(accelerator_key, accelerator_mods)[source]
Parameters:
  • accelerator_key (int) – accelerator keyval

  • accelerator_mods (Gdk.ModifierType) – accelerator modifier mask

Returns:

a newly-allocated string representing the accelerator

Return type:

str

Converts an accelerator keyval and modifier mask into a string which can be used to represent the accelerator to the user.

Gtk.accelerator_get_label_with_keycode(display, accelerator_key, keycode, accelerator_mods)[source]
Parameters:
  • display (Gdk.Display or None) – a GdkDisplay or None to use the default display

  • accelerator_key (int) – accelerator keyval

  • keycode (int) – accelerator keycode

  • accelerator_mods (Gdk.ModifierType) – accelerator modifier mask

Returns:

a newly-allocated string representing the accelerator

Return type:

str

Converts an accelerator keyval and modifier mask into a string that can be displayed to the user.

The string may be translated.

This function is similar to [func`Gtk`.accelerator_get_label], but handling keycodes. This is only useful for system-level components, applications should use [func`Gtk`.accelerator_get_label] instead.

Gtk.accelerator_name(accelerator_key, accelerator_mods)[source]
Parameters:
  • accelerator_key (int) – accelerator keyval

  • accelerator_mods (Gdk.ModifierType) – accelerator modifier mask

Returns:

a newly-allocated accelerator name

Return type:

str

Converts an accelerator keyval and modifier mask into a string parseable by Gtk.accelerator_parse().

For example, if you pass in Gdk.KEY_q and Gdk.ModifierType.CONTROL_MASK, this function returns <Control>q.

If you need to display accelerators in the user interface, see [func`Gtk`.accelerator_get_label].

Gtk.accelerator_name_with_keycode(display, accelerator_key, keycode, accelerator_mods)[source]
Parameters:
  • display (Gdk.Display or None) – a GdkDisplay or None to use the default display

  • accelerator_key (int) – accelerator keyval

  • keycode (int) – accelerator keycode

  • accelerator_mods (Gdk.ModifierType) – accelerator modifier mask

Returns:

a newly allocated accelerator name.

Return type:

str

Converts an accelerator keyval and modifier mask into a string parseable by Gtk.accelerator_parse_with_keycode().

This is similar to [func`Gtk`.accelerator_name] but handling keycodes. This is only useful for system-level components, applications should use [func`Gtk`.accelerator_name] instead.

Gtk.accelerator_parse(accelerator)[source]
Parameters:

accelerator (str) – string representing an accelerator

Returns:

accelerator_key:

return location for accelerator keyval

accelerator_mods:

return location for accelerator modifier mask

Return type:

(bool, accelerator_key: int, accelerator_mods: Gdk.ModifierType)

Parses a string representing an accelerator.

The format looks like “<Control>a” or “<Shift><Alt>F1”.

The parser is fairly liberal and allows lower or upper case, and also abbreviations such as “<Ctl>” and “<Ctrl>”.

Key names are parsed using [func`Gdk`.keyval_from_name]. For character keys the name is not the symbol, but the lowercase name, e.g. one would use “<Ctrl>minus” instead of “<Ctrl>-”.

Modifiers are enclosed in angular brackets <>, and match the [flags`Gdk`.ModifierType] mask:

  • <Shift> for GDK_SHIFT_MASK

  • <Ctrl> for GDK_CONTROL_MASK

  • <Alt> for GDK_ALT_MASK

  • <Meta> for GDK_META_MASK

  • <Super> for GDK_SUPER_MASK

  • <Hyper> for GDK_HYPER_MASK

If the parse operation fails, accelerator_key and accelerator_mods will be set to 0 (zero).

Gtk.accelerator_parse_with_keycode(accelerator, display)[source]
Parameters:
  • accelerator (str) – string representing an accelerator

  • display (Gdk.Display or None) – the GdkDisplay to look up accelerator_codes in

Returns:

True if parsing succeeded

accelerator_key:

return location for accelerator keyval

accelerator_codes:

return location for accelerator keycodes

accelerator_mods:

return location for accelerator modifier mask

Return type:

(bool, accelerator_key: int, accelerator_codes: [int], accelerator_mods: Gdk.ModifierType)

Parses a string representing an accelerator.

This is similar to [func`Gtk`.accelerator_parse] but handles keycodes as well. This is only useful for system-level components, applications should use [func`Gtk`.accelerator_parse] instead.

If accelerator_codes is given and the result stored in it is non-None, the result must be freed with GLib.free().

If a keycode is present in the accelerator and no accelerator_codes is given, the parse will fail.

If the parse fails, accelerator_key, accelerator_mods and accelerator_codes will be set to 0 (zero).

Gtk.accelerator_valid(keyval, modifiers)[source]
Parameters:
Returns:

True if the accelerator is valid

Return type:

bool

Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator.

For example, the Gdk.KEY_a keyval plus Gdk.ModifierType.CONTROL_MASK mark is valid, and matches the “Ctrl+a” accelerator. But, you can’t, for instance, use the Gdk.KEY_Control_L keyval as an accelerator.

Gtk.accessible_property_init_value(property, value)[source]
Parameters:
Gtk.accessible_relation_init_value(relation, value)[source]
Parameters:
Gtk.accessible_state_init_value(state, value)[source]
Parameters:
Gtk.bitset_iter_init_at(set, target)[source]
Parameters:
  • set (Gtk.Bitset) – a GtkBitset

  • target (int) – target value to start iterating at

Returns:

True if a value was found.

iter:

a pointer to an uninitialized GtkBitsetIter

value:

Set to the found value in set

Return type:

(bool, iter: Gtk.BitsetIter, value: int)

Initializes iter to point to target.

If target is not found, finds the next value after it. If no value >= target exists in set, this function returns False.

Gtk.bitset_iter_init_first(set)[source]
Parameters:

set (Gtk.Bitset) – a GtkBitset

Returns:

True if set isn’t empty.

iter:

a pointer to an uninitialized GtkBitsetIter

value:

Set to the first value in set

Return type:

(bool, iter: Gtk.BitsetIter, value: int)

Initializes an iterator for set and points it to the first value in set.

If set is empty, False is returned and value is set to GObject.G_MAXUINT.

Gtk.bitset_iter_init_last(set)[source]
Parameters:

set (Gtk.Bitset) – a GtkBitset

Returns:

True if set isn’t empty.

iter:

a pointer to an uninitialized GtkBitsetIter

value:

Set to the last value in set

Return type:

(bool, iter: Gtk.BitsetIter, value: int)

Initializes an iterator for set and points it to the last value in set.

If set is empty, False is returned.

Gtk.builder_error_quark()[source]
Return type:

int

Gtk.check_version(required_major, required_minor, required_micro)[source]
Parameters:
  • required_major (int) – the required major version

  • required_minor (int) – the required minor version

  • required_micro (int) – the required micro version

Returns:

None if the GTK library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by GTK and should not be modified or freed.

Return type:

str or None

Checks that the GTK library in use is compatible with the given version.

Generally you would pass in the constants Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION, Gtk.MICRO_VERSION as the three arguments to this function; that produces a check that the library in use is compatible with the version of GTK the application or module was compiled against.

Compatibility is defined by two things: first the version of the running library is newer than the version required_major.required_minor.`required_micro`. Second the running library must be binary compatible with the version required_major.required_minor.`required_micro` (same major version.)

This function is primarily for GTK modules; the module can call this function to check that it wasn’t loaded into an incompatible version of GTK. However, such a check isn’t completely reliable, since the module may be linked against an old version of GTK and calling the old version of Gtk.check_version(), but still get loaded into an application using a newer version of GTK.

Gtk.constraint_vfl_parser_error_quark()[source]
Return type:

int

Gtk.css_parser_error_quark()[source]
Return type:

int

Gtk.css_parser_warning_quark()[source]
Return type:

int

Gtk.dialog_error_quark()[source]
Return type:

int

Gtk.disable_setlocale()[source]

Prevents [id`gtk_init`] and [id`gtk_init_check`] from automatically calling setlocale (LC_ALL, "").

You would want to use this function if you wanted to set the locale for your program to something other than the user’s locale, or if you wanted to set different values for different locale categories.

Most programs should not need to call this function.

Gtk.distribute_natural_allocation(extra_space, sizes)[source]
Parameters:
  • extra_space (int) – Extra space to redistribute among children after subtracting minimum sizes and any child padding from the overall allocation

  • sizes ([Gtk.RequestedSize]) – An array of structs with a client pointer and a minimum/natural size in the orientation of the allocation.

Returns:

The remainder of extra_space after redistributing space to sizes.

Return type:

int

Distributes extra_space to child sizes by bringing smaller children up to natural size first.

The remaining space will be added to the minimum_size member of the GtkRequestedSize struct. If all sizes reach their natural size then the remaining space is returned.

Gtk.editable_delegate_get_property(object, prop_id, value, pspec)[source]
Parameters:
Returns:

True if the property was found

Return type:

bool

Gets a property of the GtkEditable delegate for object.

This is helper function that should be called in the get_property function of your GtkEditable implementation, before handling your own properties.

Gtk.editable_delegate_set_property(object, prop_id, value, pspec)[source]
Parameters:
Returns:

True if the property was found

Return type:

bool

Sets a property on the GtkEditable delegate for object.

This is a helper function that should be called in the set_property function of your GtkEditable implementation, before handling your own properties.

Gtk.editable_install_properties(object_class, first_prop)[source]
Parameters:
  • object_class (GObject.ObjectClass) – a GObjectClass

  • first_prop (int) – property ID to use for the first property

Returns:

the number of properties that were installed

Return type:

int

Overrides the GtkEditable properties for class.

This is a helper function that should be called in class_init, after installing your own properties.

Note that your class must have “text”, “cursor-position”, “selection-bound”, “editable”, “width-chars”, “max-width-chars”, “xalign” and “enable-undo” properties for this function to work.

To handle the properties in your set_property and get_property functions, you can either use [func`Gtk`.Editable.delegate_set_property] and [func`Gtk`.Editable.delegate_get_property] (if you are using a delegate), or remember the first_prop offset and add it to the values in the [enum`Gtk`.EditableProperties] enumeration to get the property IDs for these properties.

Gtk.enumerate_printers(func, data, wait)[source]
Parameters:
  • func (Gtk.PrinterFunc) – a function to call for each printer

  • data (object or None) – user data to pass to func

  • wait (bool) – if True, wait in a recursive mainloop until all printers are enumerated; otherwise return early

Calls a function for all ``GtkPrinter``s.

If func returns True, the enumeration is stopped.

Gtk.file_chooser_error_quark()[source]
Returns:

The error quark used for GtkFileChooser errors.

Return type:

int

Registers an error quark for GtkFileChooser errors.

Gtk.get_binary_age()[source]
Returns:

the binary age of the GTK library

Return type:

int

Returns the binary age as passed to libtool.

If libtool means nothing to you, don’t worry about it.

Gtk.get_debug_flags()[source]
Returns:

the GTK debug flags.

Return type:

Gtk.DebugFlags

Returns the GTK debug flags that are currently active.

This function is intended for GTK modules that want to adjust their debug output based on GTK debug flags.

Gtk.get_default_language()[source]
Returns:

the default language

Return type:

Pango.Language

Returns the PangoLanguage for the default language currently in effect.

Note that this can change over the life of an application.

The default language is derived from the current locale. It determines, for example, whether GTK uses the right-to-left or left-to-right text direction.

This function is equivalent to [func`Pango`.Language.get_default]. See that function for details.

Gtk.get_interface_age()[source]
Returns:

the interface age of the GTK library

Return type:

int

Returns the interface age as passed to libtool.

If libtool means nothing to you, don’t worry about it.

Gtk.get_locale_direction()[source]
Returns:

the direction of the current locale

Return type:

Gtk.TextDirection

Get the direction of the current locale. This is the expected reading direction for text and UI.

This function depends on the current locale being set with setlocale() and will default to setting the Gtk.TextDirection.LTR direction otherwise. Gtk.TextDirection.NONE will never be returned.

GTK sets the default text direction according to the locale during Gtk.init(), and you should normally use Gtk.Widget.get_direction() or Gtk.Widget.get_default_direction() to obtain the current direction.

This function is only needed rare cases when the locale is changed after GTK has already been initialized. In this case, you can use it to update the default text direction as follows:

#include <locale.h>

static void
update_locale (const char *new_locale)
{
  setlocale (LC_ALL, new_locale);
  gtk_widget_set_default_direction (gtk_get_locale_direction ());
}
Gtk.get_major_version()[source]
Returns:

the major version number of the GTK library

Return type:

int

Returns the major version number of the GTK library.

For example, in GTK version 3.1.5 this is 3.

This function is in the library, so it represents the GTK library your code is running against. Contrast with the Gtk.MAJOR_VERSION macro, which represents the major version of the GTK headers you have included when compiling your code.

Gtk.get_micro_version()[source]
Returns:

the micro version number of the GTK library

Return type:

int

Returns the micro version number of the GTK library.

For example, in GTK version 3.1.5 this is 5.

This function is in the library, so it represents the GTK library your code is are running against. Contrast with the Gtk.MICRO_VERSION macro, which represents the micro version of the GTK headers you have included when compiling your code.

Gtk.get_minor_version()[source]
Returns:

the minor version number of the GTK library

Return type:

int

Returns the minor version number of the GTK library.

For example, in GTK version 3.1.5 this is 1.

This function is in the library, so it represents the GTK library your code is are running against. Contrast with the Gtk.MINOR_VERSION macro, which represents the minor version of the GTK headers you have included when compiling your code.

Gtk.hsv_to_rgb(h, s, v)[source]
Parameters:
Returns:

r:

Return value for the red component

g:

Return value for the green component

b:

Return value for the blue component

Return type:

(r: float, g: float, b: float)

Converts a color from HSV space to RGB.

Input values must be in the [0.0, 1.0] range; output values will be in the same range.

Gtk.icon_theme_error_quark()[source]
Return type:

int

Gtk.init()[source]

Call this function before using any other GTK functions in your GUI applications. It will initialize everything needed to operate the toolkit.

If you are using GtkApplication, you usually don’t have to call this function; the GApplication::startup handler does it for you. Though, if you are using Gio.Application methods that will be invoked before startup, such as local_command_line, you may need to initialize stuff explicitly.

This function will terminate your program if it was unable to initialize the windowing system for some reason. If you want your program to fall back to a textual interface, call [func`Gtk`.init_check] instead.

GTK calls signal (SIGPIPE, SIG_IGN) during initialization, to ignore SIGPIPE signals, since these are almost never wanted in graphical applications. If you do need to handle SIGPIPE for some reason, reset the handler after Gtk.init(), but notice that other libraries (e.g. libdbus or gvfs) might do similar things.

Gtk.init_check()[source]
Returns:

True if the windowing system has been successfully initialized, False otherwise

Return type:

bool

This function does the same work as Gtk.init() with only a single change: It does not terminate the program if the windowing system can’t be initialized. Instead it returns False on failure.

This way the application can fall back to some other means of communication with the user - for example a curses or command line interface.

Gtk.is_initialized()[source]
Returns:

the initialization status

Return type:

bool

Use this function to check if GTK has been initialized.

See [func`Gtk`.init].

Gtk.native_get_for_surface(surface)[source]
Parameters:

surface (Gdk.Surface) – a GdkSurface

Returns:

the GtkNative that is associated with surface

Return type:

Gtk.Native or None

Finds the GtkNative associated with the surface.

Gtk.paper_size_get_default()[source]
Returns:

the name of the default paper size. The string is owned by GTK and should not be modified.

Return type:

str

Returns the name of the default paper size, which depends on the current locale.

Gtk.paper_size_get_paper_sizes(include_custom)[source]
Parameters:

include_custom (bool) – whether to include custom paper sizes as defined in the page setup dialog

Returns:

a newly allocated list of newly allocated GtkPaperSize objects

Return type:

[Gtk.PaperSize]

Creates a list of known paper sizes.

Gtk.param_spec_expression(name, nick, blurb, flags)[source]
Parameters:
  • name (str) – canonical name of the property

  • nick (str) – a user-readable name for the property

  • blurb (str) – a user-readable description of the property

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

Returns:

a newly created property specification

Return type:

GObject.ParamSpec

Creates a new GParamSpec instance for a property holding a GtkExpression.

See g_param_spec_internal() for details on the property strings.

Gtk.print_error_quark()[source]
Returns:

The error quark used for GtkPrintOperation errors.

Return type:

int

Registers an error quark for GtkPrintOperation if necessary.

Gtk.print_run_page_setup_dialog(parent, page_setup, settings)[source]
Parameters:
Returns:

a new GtkPageSetup

Return type:

Gtk.PageSetup

Runs a page setup dialog, letting the user modify the values from page_setup. If the user cancels the dialog, the returned GtkPageSetup is identical to the passed in page_setup, otherwise it contains the modifications done in the dialog.

Note that this function may use a recursive mainloop to show the page setup dialog. See Gtk.print_run_page_setup_dialog_async() if this is a problem.

Gtk.print_run_page_setup_dialog_async(parent, page_setup, settings, done_cb, *data)[source]
Parameters:

Runs a page setup dialog, letting the user modify the values from page_setup.

In contrast to Gtk.print_run_page_setup_dialog(), this function returns after showing the page setup dialog on platforms that support this, and calls done_cb from a signal handler for the ::response signal of the dialog.

Gtk.recent_manager_error_quark()[source]
Return type:

int

Gtk.render_activity(context, cr, x, y, width, height)[source]
Parameters:

Renders an activity indicator (such as in GtkSpinner). The state Gtk.StateFlags.CHECKED determines whether there is activity going on.

Deprecated since version 4.10.

Gtk.render_arrow(context, cr, angle, x, y, size)[source]
Parameters:
  • context (Gtk.StyleContext) – a GtkStyleContext

  • cr (cairo.Context) – a cairo_t

  • angle (float) – arrow angle from 0 to 2 * GLib.PI, being 0 the arrow pointing to the north

  • x (float) – X origin of the render area

  • y (float) – Y origin of the render area

  • size (float) – square side for render area

Renders an arrow pointing to angle.

Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π:

Deprecated since version 4.10.

Gtk.render_background(context, cr, x, y, width, height)[source]
Parameters:

Renders the background of an element.

Typical background rendering, showing the effect of background-image, border-width and border-radius :

Deprecated since version 4.10.

Gtk.render_check(context, cr, x, y, width, height)[source]
Parameters:

Renders a checkmark (as in a GtkCheckButton).

The Gtk.StateFlags.CHECKED state determines whether the check is on or off, and Gtk.StateFlags.INCONSISTENT determines whether it should be marked as undefined.

Typical checkmark rendering:

Deprecated since version 4.10.

Gtk.render_expander(context, cr, x, y, width, height)[source]
Parameters:

Renders an expander (as used in GtkTreeView and GtkExpander) in the area defined by x, y, width, height. The state Gtk.StateFlags.CHECKED determines whether the expander is collapsed or expanded.

Typical expander rendering:

Deprecated since version 4.10.

Gtk.render_focus(context, cr, x, y, width, height)[source]
Parameters:

Renders a focus indicator on the rectangle determined by x, y, width, height.

Typical focus rendering:

Deprecated since version 4.10.

Gtk.render_frame(context, cr, x, y, width, height)[source]
Parameters:

Renders a frame around the rectangle defined by x, y, width, height.

Examples of frame rendering, showing the effect of border-image, border-color, border-width, border-radius and junctions:

Deprecated since version 4.10.

Gtk.render_handle(context, cr, x, y, width, height)[source]
Parameters:

Renders a handle (as in GtkPaned and GtkWindow’s resize grip), in the rectangle determined by x, y, width, height.

Handles rendered for the paned and grip classes:

Deprecated since version 4.10.

Gtk.render_icon(context, cr, texture, x, y)[source]
Parameters:

Renders the icon in texture at the specified x and y coordinates.

This function will render the icon in texture at exactly its size, regardless of scaling factors, which may not be appropriate when drawing on displays with high pixel densities.

Deprecated since version 4.10.

Gtk.render_layout(context, cr, x, y, layout)[source]
Parameters:

Renders layout on the coordinates x, y

Deprecated since version 4.10.

Gtk.render_line(context, cr, x0, y0, x1, y1)[source]
Parameters:
  • context (Gtk.StyleContext) – a GtkStyleContext

  • cr (cairo.Context) – a cairo_t

  • x0 (float) – X coordinate for the origin of the line

  • y0 (float) – Y coordinate for the origin of the line

  • x1 (float) – X coordinate for the end of the line

  • y1 (float) – Y coordinate for the end of the line

Renders a line from (x0, y0) to (x1, y1).

Deprecated since version 4.10.

Gtk.render_option(context, cr, x, y, width, height)[source]
Parameters:

Renders an option mark (as in a radio button), the Gtk.StateFlags.CHECKED state will determine whether the option is on or off, and Gtk.StateFlags.INCONSISTENT whether it should be marked as undefined.

Typical option mark rendering:

Deprecated since version 4.10.

Gtk.rgb_to_hsv(r, g, b)[source]
Parameters:
Returns:

h:

Return value for the hue component

s:

Return value for the saturation component

v:

Return value for the value component

Return type:

(h: float, s: float, v: float)

Converts a color from RGB space to HSV.

Input values must be in the [0.0, 1.0] range; output values will be in the same range.

Gtk.set_debug_flags(flags)[source]
Parameters:

flags (Gtk.DebugFlags) – the debug flags to set

Sets the GTK debug flags.

Gtk.show_uri(parent, uri, timestamp)[source]
Parameters:

This function launches the default application for showing a given uri, or shows an error dialog if that fails.

Deprecated since version 4.10: Use [method`Gtk`.FileLauncher.launch] or [method`Gtk`.UriLauncher.launch] instead

Gtk.show_uri_full(parent, uri, timestamp, cancellable, callback, *user_data)[source]
Parameters:

This function launches the default application for showing a given uri.

The callback will be called when the launch is completed. It should call Gtk.show_uri_full_finish() to obtain the result.

This is the recommended call to be used as it passes information necessary for sandbox helpers to parent their dialogs properly.

Deprecated since version 4.10: Use [method`Gtk`.FileLauncher.launch] or [method`Gtk`.UriLauncher.launch] instead

Gtk.show_uri_full_finish(parent, result)[source]
Parameters:
Raises:

GLib.Error

Returns:

True if the URI was shown successfully. Otherwise, False is returned and error is set

Return type:

bool

Finishes the Gtk.show_uri() call and returns the result of the operation.

Deprecated since version 4.10: Use [method`Gtk`.FileLauncher.launch_finish] or [method`Gtk`.UriLauncher.launch_finish] instead

Gtk.test_accessible_assertion_message_role(domain, file, line, func, expr, accessible, expected_role, actual_role)[source]
Parameters:
Gtk.test_accessible_has_property(accessible, property)[source]
Parameters:
Returns:

True if the property is set in the accessible

Return type:

bool

Checks whether the GtkAccessible has property set.

Gtk.test_accessible_has_relation(accessible, relation)[source]
Parameters:
Returns:

True if the relation is set in the accessible

Return type:

bool

Checks whether the GtkAccessible has relation set.

Gtk.test_accessible_has_role(accessible, role)[source]
Parameters:
Returns:

True if the role matches

Return type:

bool

Checks whether the GtkAccessible:accessible-role of the accessible is role.

Gtk.test_accessible_has_state(accessible, state)[source]
Parameters:
Returns:

True if the state is set in the accessible

Return type:

bool

Checks whether the GtkAccessible has state set.

Gtk.test_list_all_types()[source]
Returns:

0-terminated array of type ids

Return type:

[GObject.GType]

Return the type ids that have been registered after calling Gtk.test_register_all_types().

Gtk.test_register_all_types()[source]

Force registration of all core GTK object types.

This allows to refer to any of those object types via GObject.type_from_name() after calling this function.

Gtk.test_widget_wait_for_draw(widget)[source]
Parameters:

widget (Gtk.Widget) – the widget to wait for

Enters the main loop and waits for widget to be “drawn”.

In this context that means it waits for the frame clock of widget to have run a full styling, layout and drawing cycle.

This function is intended to be used for syncing with actions that depend on widget relayouting or on interaction with the display server.

Gtk.tree_create_row_drag_content(tree_model, path)[source]
Parameters:
Returns:

a new GdkContentProvider

Return type:

Gdk.ContentProvider

Creates a content provider for dragging path from tree_model.

Deprecated since version 4.10: Use list models instead

Gtk.tree_get_row_drag_data(value)[source]
Parameters:

value (GObject.Value) – a GValue

Returns:

True if selection_data had target type %GTK_TYPE_TREE_ROW_DATA is otherwise valid

tree_model:

a GtkTreeModel

path:

row in tree_model

Return type:

(bool, tree_model: Gtk.TreeModel or None, path: Gtk.TreePath or None)

Obtains a tree_model and path from value of target type %GTK_TYPE_TREE_ROW_DATA.

The returned path must be freed with Gtk.TreePath.free().

Deprecated since version 4.10: Use list models instead

Gtk.tree_row_reference_deleted(proxy, path)[source]
Parameters:

Lets a set of row reference created by Gtk.TreeRowReference.new_proxy() know that the model emitted the ::row-deleted signal.

Deprecated since version 4.10.

Gtk.tree_row_reference_inserted(proxy, path)[source]
Parameters:

Lets a set of row reference created by Gtk.TreeRowReference.new_proxy() know that the model emitted the ::row-inserted signal.

Deprecated since version 4.10.

Gtk.value_dup_expression(value)[source]
Parameters:

value (GObject.Value) – a GValue initialized with type GTK_TYPE_EXPRESSION

Returns:

a GtkExpression

Return type:

Gtk.Expression or None

Retrieves the GtkExpression stored inside the given value, and acquires a reference to it.

Gtk.value_get_expression(value)[source]
Parameters:

value (GObject.Value) – a GValue initialized with type GTK_TYPE_EXPRESSION

Returns:

a GtkExpression

Return type:

Gtk.Expression or None

Retrieves the GtkExpression stored inside the given value.

Gtk.value_set_expression(value, expression)[source]
Parameters:

Stores the given GtkExpression inside value.

The GValue will acquire a reference to the expression.

Gtk.value_take_expression(value, expression)[source]
Parameters:

Stores the given GtkExpression inside value.

This function transfers the ownership of the expression to the GValue.