Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- Gtk.accelerator_get_default_mod_mask()[source]¶
- Returns:
the modifier mask for accelerators
- Return type:
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 keyvalaccelerator_mods (
Gdk.ModifierType
) – accelerator modifier mask
- Returns:
a newly-allocated string representing the accelerator
- Return type:
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
orNone
) – aGdkDisplay
orNone
to use the default displayaccelerator_key (
int
) – accelerator keyvalkeycode (
int
) – accelerator keycodeaccelerator_mods (
Gdk.ModifierType
) – accelerator modifier mask
- Returns:
a newly-allocated string representing the accelerator
- Return type:
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 keyvalaccelerator_mods (
Gdk.ModifierType
) – accelerator modifier mask
- Returns:
a newly-allocated accelerator name
- Return type:
Converts an accelerator keyval and modifier mask into a string parseable by
Gtk.accelerator_parse
().For example, if you pass in
Gdk.KEY_q
andGdk.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
orNone
) – aGdkDisplay
orNone
to use the default displayaccelerator_key (
int
) – accelerator keyvalkeycode (
int
) – accelerator keycodeaccelerator_mods (
Gdk.ModifierType
) – accelerator modifier mask
- Returns:
a newly allocated accelerator name.
- Return type:
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>
forGDK_SHIFT_MASK
<Ctrl>
forGDK_CONTROL_MASK
<Alt>
forGDK_ALT_MASK
<Meta>
forGDK_META_MASK
<Super>
forGDK_SUPER_MASK
<Hyper>
forGDK_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 acceleratordisplay (
Gdk.Display
orNone
) – theGdkDisplay
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 withGLib.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:
keyval (
int
) – a GDK keyvalmodifiers (
Gdk.ModifierType
) – modifier mask
- Returns:
True
if the accelerator is valid- Return type:
Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator.
For example, the
Gdk.KEY_a
keyval plusGdk.ModifierType.CONTROL_MASK
mark is valid, and matches the “Ctrl+a” accelerator. But, you can’t, for instance, use theGdk.KEY_Control_L
keyval as an accelerator.
- Gtk.accessible_property_init_value(property, value)[source]¶
- Parameters:
property (
Gtk.AccessibleProperty
) –value (
GObject.Value
) –
- Gtk.accessible_relation_init_value(relation, value)[source]¶
- Parameters:
relation (
Gtk.AccessibleRelation
) –value (
GObject.Value
) –
- Gtk.accessible_state_init_value(state, value)[source]¶
- Parameters:
state (
Gtk.AccessibleState
) –value (
GObject.Value
) –
- Gtk.bitset_iter_init_at(set, target)[source]¶
- Parameters:
set (
Gtk.Bitset
) – aGtkBitset
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
) – aGtkBitset
- 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 toGObject.G_MAXUINT
.
- Gtk.bitset_iter_init_last(set)[source]¶
- Parameters:
set (
Gtk.Bitset
) – aGtkBitset
- 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.check_version(required_major, required_minor, required_micro)[source]¶
- Parameters:
- 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:
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.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 allocationsizes ([
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:
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:
object (
GObject.Object
) – aGObject
prop_id (
int
) – a property IDvalue (
GObject.Value
) – value to setpspec (
GObject.ParamSpec
) – theGParamSpec
for the property
- Returns:
True
if the property was found- Return type:
Gets a property of the
GtkEditable
delegate for object.This is helper function that should be called in the
get_property
function of yourGtkEditable
implementation, before handling your own properties.
- Gtk.editable_delegate_set_property(object, prop_id, value, pspec)[source]¶
- Parameters:
object (
GObject.Object
) – aGObject
prop_id (
int
) – a property IDvalue (
GObject.Value
) – value to setpspec (
GObject.ParamSpec
) – theGParamSpec
for the property
- Returns:
True
if the property was found- Return type:
Sets a property on the
GtkEditable
delegate for object.This is a helper function that should be called in the
set_property
function of yourGtkEditable
implementation, before handling your own properties.
- Gtk.editable_install_properties(object_class, first_prop)[source]¶
- Parameters:
object_class (
GObject.ObjectClass
) – aGObjectClass
first_prop (
int
) – property ID to use for the first property
- Returns:
the number of properties that were installed
- Return type:
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 printerwait (
bool
) – ifTrue
, 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:
Registers an error quark for
GtkFileChooser
errors.
- Gtk.get_binary_age()[source]¶
- Returns:
the binary age of the GTK library
- Return type:
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:
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:
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:
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:
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 useGtk.Widget.get_direction
() orGtk.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:
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:
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:
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:
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.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; theGApplication::startup
handler does it for you. Though, if you are usingGio.Application
methods that will be invoked beforestartup
, such aslocal_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 afterGtk.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:
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 returnsFalse
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:
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
) – aGdkSurface
- Returns:
the
GtkNative
that is associated with surface- Return type:
Gtk.Native
orNone
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:
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:
Creates a list of known paper sizes.
- Gtk.param_spec_expression(name, nick, blurb, flags)[source]¶
- Parameters:
name (
str
) – canonical name of the propertynick (
str
) – a user-readable name for the propertyblurb (
str
) – a user-readable description of the propertyflags (
GObject.ParamFlags
) – flags for the property
- Returns:
a newly created property specification
- Return type:
Creates a new
GParamSpec
instance for a property holding aGtkExpression
.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:
Registers an error quark for
GtkPrintOperation
if necessary.
- Gtk.print_run_page_setup_dialog(parent, page_setup, settings)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – transient parentpage_setup (
Gtk.PageSetup
orNone
) – an existingGtkPageSetup
settings (
Gtk.PrintSettings
) – aGtkPrintSettings
- Returns:
a new
GtkPageSetup
- Return type:
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:
parent (
Gtk.Window
orNone
) – transient parentpage_setup (
Gtk.PageSetup
orNone
) – an existingGtkPageSetup
settings (
Gtk.PrintSettings
) – aGtkPrintSettings
done_cb (
Gtk.PageSetupDoneFunc
) – a function to call when the user saves the modified page setup
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.render_activity(context, cr, x, y, width, height)[source]¶
- Parameters:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
Renders an activity indicator (such as in
GtkSpinner
). The stateGtk.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
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
angle (
float
) – arrow angle from 0 to 2 *GLib.PI
, being 0 the arrow pointing to the northx (
float
) – X origin of the render areay (
float
) – Y origin of the render areasize (
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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
Renders the background of an element.
Typical background rendering, showing the effect of
background-image
,border-width
andborder-radius
:Deprecated since version 4.10.
- Gtk.render_check(context, cr, x, y, width, height)[source]¶
- Parameters:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
Renders a checkmark (as in a
GtkCheckButton
).The
Gtk.StateFlags.CHECKED
state determines whether the check is on or off, andGtk.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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
Renders an expander (as used in
GtkTreeView
andGtkExpander
) in the area defined by x, y, width, height. The stateGtk.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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
Renders a handle (as in
GtkPaned
andGtkWindow
’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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
texture (
Gdk.Texture
) – aGdkTexture
containing the icon to drawx (
float
) – X position for the texturey (
float
) – Y position for the texture
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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X originy (
float
) – Y originlayout (
Pango.Layout
) – thePangoLayout
to render
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
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x0 (
float
) – X coordinate for the origin of the liney0 (
float
) – Y coordinate for the origin of the linex1 (
float
) – X coordinate for the end of the liney1 (
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:
context (
Gtk.StyleContext
) – aGtkStyleContext
cr (
cairo.Context
) – acairo_t
x (
float
) – X origin of the rectangley (
float
) – Y origin of the rectanglewidth (
float
) – rectangle widthheight (
float
) – rectangle height
Renders an option mark (as in a radio button), the
Gtk.StateFlags.CHECKED
state will determine whether the option is on or off, andGtk.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:
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:
parent (
Gtk.Window
orNone
) – parent windowuri (
str
) – the uri to showtimestamp (
int
) – timestamp from the event that triggered this call, orGdk.CURRENT_TIME
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:
parent (
Gtk.Window
orNone
) – parent windowuri (
str
) – the uri to showtimestamp (
int
) – timestamp from the event that triggered this call, orGdk.CURRENT_TIME
cancellable (
Gio.Cancellable
orNone
) – aGCancellable
to cancel the launchcallback (
Gio.AsyncReadyCallback
orNone
) – a callback to call when the action is complete
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:
parent (
Gtk.Window
) – theGtkWindow
passed toGtk.show_uri
()result (
Gio.AsyncResult
) –GAsyncResult
that was passed to callback
- Raises:
- Returns:
True
if the URI was shown successfully. Otherwise,False
is returned and error is set- Return type:
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:
domain (
str
) –file (
str
) –line (
int
) –func (
str
) –expr (
str
) –accessible (
Gtk.Accessible
) –expected_role (
Gtk.AccessibleRole
) –actual_role (
Gtk.AccessibleRole
) –
- Gtk.test_accessible_has_property(accessible, property)[source]¶
- Parameters:
accessible (
Gtk.Accessible
) – aGtkAccessible
property (
Gtk.AccessibleProperty
) – aGtkAccessibleProperty
- Returns:
True
if the property is set in the accessible- Return type:
Checks whether the
GtkAccessible
has property set.
- Gtk.test_accessible_has_relation(accessible, relation)[source]¶
- Parameters:
accessible (
Gtk.Accessible
) – aGtkAccessible
relation (
Gtk.AccessibleRelation
) – aGtkAccessibleRelation
- Returns:
True
if the relation is set in the accessible- Return type:
Checks whether the
GtkAccessible
has relation set.
- Gtk.test_accessible_has_role(accessible, role)[source]¶
- Parameters:
accessible (
Gtk.Accessible
) – aGtkAccessible
role (
Gtk.AccessibleRole
) – aGtkAccessibleRole
- Returns:
True
if the role matches- Return type:
Checks whether the
GtkAccessible:accessible-role
of the accessible is role.
- Gtk.test_accessible_has_state(accessible, state)[source]¶
- Parameters:
accessible (
Gtk.Accessible
) – aGtkAccessible
state (
Gtk.AccessibleState
) – aGtkAccessibleState
- Returns:
True
if the state is set in the accessible- Return type:
Checks whether the
GtkAccessible
has state set.
- Gtk.test_list_all_types()[source]¶
- Returns:
0-terminated array of type ids
- Return type:
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:
tree_model (
Gtk.TreeModel
) – aGtkTreeModel
path (
Gtk.TreePath
) – a row in tree_model
- Returns:
a new
GdkContentProvider
- Return type:
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
) – aGValue
- 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
orNone
, path:Gtk.TreePath
orNone
)
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:
proxy (
GObject.Object
) – aGObject
path (
Gtk.TreePath
) – the path position that was deleted
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:
proxy (
GObject.Object
) – aGObject
path (
Gtk.TreePath
) – the row position that was inserted
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
) – aGValue
initialized with typeGTK_TYPE_EXPRESSION
- Returns:
a
GtkExpression
- Return type:
Retrieves the
GtkExpression
stored inside the givenvalue
, and acquires a reference to it.
- Gtk.value_get_expression(value)[source]¶
- Parameters:
value (
GObject.Value
) – aGValue
initialized with typeGTK_TYPE_EXPRESSION
- Returns:
a
GtkExpression
- Return type:
Retrieves the
GtkExpression
stored inside the givenvalue
.
- Gtk.value_set_expression(value, expression)[source]¶
- Parameters:
value (
GObject.Value
) – aGValue
initialized with typeGTK_TYPE_EXPRESSION
expression (
Gtk.Expression
) – aGtkExpression
Stores the given
GtkExpression
insidevalue
.The
GValue
will acquire a reference to theexpression
.
- Gtk.value_take_expression(value, expression)[source]¶
- Parameters:
value (
GObject.Value
) – aGValue
initialized with typeGTK_TYPE_EXPRESSION
expression (
Gtk.Expression
orNone
) – aGtkExpression
Stores the given
GtkExpression
insidevalue
.This function transfers the ownership of the
expression
to theGValue
.