Gtk.Gradient¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gtk.Gradient¶
Gtk.Gradient
is a boxed type that represents a gradient. It is the result of parsing a ‘gradient expression [gtkcssprovider-gradients]’. To obtain the gradient represented by aGtk.Gradient
, it has to be resolved withGtk.Gradient.resolve
(), which replaces all symbolic color references by the colors they refer to (in a given context) and constructs acairo.Pattern
value.It is not normally necessary to deal directly with
Gtk.Gradients
, since they are mostly used behind the scenes byGtk.StyleContext
andGtk.CssProvider
.Gtk.Gradient
is deprecated. It was used internally by GTK’s CSS engine to represent gradients. As its handling is not conforming to modern web standards, it is not used anymore. If you want to use gradients in your own code, please use Cairo directly.- classmethod new_linear(x0, y0, x1, y1)[source]¶
- Parameters:
- Returns:
A newly created
Gtk.Gradient
- Return type:
Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient a number of stop colors must be added through
Gtk.Gradient.add_color_stop
().New in version 3.0.
Deprecated since version 3.8:
Gtk.Gradient
is deprecated.
- classmethod new_radial(x0, y0, radius0, x1, y1, radius1)[source]¶
- Parameters:
- Returns:
A newly created
Gtk.Gradient
- Return type:
Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and (x1, y1, radius1). Before using the gradient a number of stop colors must be added through
Gtk.Gradient.add_color_stop
().New in version 3.0.
Deprecated since version 3.8:
Gtk.Gradient
is deprecated.
- add_color_stop(offset, color)[source]¶
- Parameters:
offset (
float
) – offset for the color stopcolor (
Gtk.SymbolicColor
) – color to use
Adds a stop color to self.
New in version 3.0.
Deprecated since version 3.8:
Gtk.Gradient
is deprecated.
- ref()[source]¶
- Returns:
The same self
- Return type:
Increases the reference count of self.
New in version 3.0.
Deprecated since version 3.8:
Gtk.Gradient
is deprecated.
- resolve(props)[source]¶
- Parameters:
props (
Gtk.StyleProperties
) –Gtk.StyleProperties
to use when resolving named colors- Returns:
True
if the gradient has been resolved- resolved_gradient:
return location for the resolved pattern
- Return type:
(
bool
, resolved_gradient:cairo.Pattern
)
If self is resolvable, resolved_gradient will be filled in with the resolved gradient as a
cairo.Pattern
, andTrue
will be returned. Generally, if self can’t be resolved, it is due to it being defined on top of a named color that doesn’t exist in props.New in version 3.0.
Deprecated since version 3.8:
Gtk.Gradient
is deprecated.
- resolve_for_context(context)[source]¶
- Parameters:
context (
Gtk.StyleContext
) –- Return type:
- to_string()[source]¶
- Returns:
A string representation for self
- Return type:
Creates a string representation for self that is suitable for using in GTK CSS files.
Deprecated since version 3.8:
Gtk.Gradient
is deprecated.
- unref()[source]¶
Decreases the reference count of self, freeing its memory if the reference count reaches 0.
New in version 3.0.
Deprecated since version 3.8:
Gtk.Gradient
is deprecated.