Gtk.ColorSelection

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Box Gtk.Box Gtk.ColorSelection Gtk.ColorSelection Gtk.Box->Gtk.ColorSelection Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Box Gtk.Orientable->Gtk.Box Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Box (14), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

class

palette_from_string (str)

class

palette_to_string (colors)

get_current_alpha ()

get_current_color ()

get_current_rgba ()

get_has_opacity_control ()

get_has_palette ()

get_previous_alpha ()

get_previous_color ()

get_previous_rgba ()

is_adjusting ()

set_current_alpha (alpha)

set_current_color (color)

set_current_rgba (rgba)

set_has_opacity_control (has_opacity)

set_has_palette (has_palette)

set_previous_alpha (alpha)

set_previous_color (color)

set_previous_rgba (rgba)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

do_color_changed ()

Properties

Inherited:

Gtk.Box (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name

Type

Flags

Short Description

current-alpha

int

r/w

The current opacity value (0 fully transparent, 65535 fully opaque)

current-color

Gdk.Color

d/r/w

The current color deprecated

current-rgba

Gdk.RGBA

r/w

The current RGBA color

has-opacity-control

bool

r/w

Whether the color selector should allow setting opacity

has-palette

bool

r/w

Whether a palette should be used

Child Properties

Inherited:

Gtk.Box (5)

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

color-changed

This signal is emitted when the color changes in the Gtk.ColorSelection according to its update policy.

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

parent_instance

Gtk.Box

r

Class Details

class Gtk.ColorSelection(*args, **kwargs)
Bases:

Gtk.Box

Abstract:

No

Structure:

Gtk.ColorSelectionClass

classmethod new()[source]
Returns:

a new Gtk.ColorSelection

Return type:

Gtk.Widget

Creates a new Gtk.ColorSelection.

classmethod palette_from_string(str)[source]
Parameters:

str (str) – a string encoding a color palette

Returns:

True if a palette was successfully parsed

colors:

return location for allocated array of Gdk.Color

Return type:

(bool, colors: [Gdk.Color])

Parses a color palette string; the string is a colon-separated list of color names readable by Gdk.Color.parse().

classmethod palette_to_string(colors)[source]
Parameters:

colors ([Gdk.Color]) – an array of colors

Returns:

allocated string encoding the palette

Return type:

str

Encodes a palette as a string, useful for persistent storage.

get_current_alpha()[source]
Returns:

an integer between 0 and 65535

Return type:

int

Returns the current alpha value.

get_current_color()[source]
Returns:

a Gdk.Color to fill in with the current color

Return type:

color: Gdk.Color

Sets color to be the current color in the Gtk.ColorSelection widget.

Deprecated since version 3.4: Use Gtk.ColorSelection.get_current_rgba() instead.

get_current_rgba()[source]
Returns:

a Gdk.RGBA to fill in with the current color

Return type:

rgba: Gdk.RGBA

Sets rgba to be the current color in the Gtk.ColorSelection widget.

New in version 3.0.

get_has_opacity_control()[source]
Returns:

True if the self has an opacity control, False if it does’t

Return type:

bool

Determines whether the colorsel has an opacity control.

get_has_palette()[source]
Returns:

True if the selector has a palette, False if it hasn’t

Return type:

bool

Determines whether the color selector has a color palette.

get_previous_alpha()[source]
Returns:

an integer between 0 and 65535

Return type:

int

Returns the previous alpha value.

get_previous_color()[source]
Returns:

a Gdk.Color to fill in with the original color value

Return type:

color: Gdk.Color

Fills color in with the original color value.

Deprecated since version 3.4: Use Gtk.ColorSelection.get_previous_rgba() instead.

get_previous_rgba()[source]
Returns:

a Gdk.RGBA to fill in with the original color value

Return type:

rgba: Gdk.RGBA

Fills rgba in with the original color value.

New in version 3.0.

is_adjusting()[source]
Returns:

True if the user is currently dragging a color around, and False if the selection has stopped

Return type:

bool

Gets the current state of the self.

set_current_alpha(alpha)[source]
Parameters:

alpha (int) – an integer between 0 and 65535

Sets the current opacity to be alpha.

The first time this is called, it will also set the original opacity to be alpha too.

set_current_color(color)[source]
Parameters:

color (Gdk.Color) – a Gdk.Color to set the current color with

Sets the current color to be color.

The first time this is called, it will also set the original color to be color too.

Deprecated since version 3.4: Use Gtk.ColorSelection.set_current_rgba() instead.

set_current_rgba(rgba)[source]
Parameters:

rgba (Gdk.RGBA) – A Gdk.RGBA to set the current color with

Sets the current color to be rgba.

The first time this is called, it will also set the original color to be rgba too.

New in version 3.0.

set_has_opacity_control(has_opacity)[source]
Parameters:

has_opacity (bool) – True if self can set the opacity, False otherwise

Sets the self to use or not use opacity.

set_has_palette(has_palette)[source]
Parameters:

has_palette (bool) – True if palette is to be visible, False otherwise

Shows and hides the palette based upon the value of has_palette.

set_previous_alpha(alpha)[source]
Parameters:

alpha (int) – an integer between 0 and 65535

Sets the “previous” alpha to be alpha.

This function should be called with some hesitations, as it might seem confusing to have that alpha change.

set_previous_color(color)[source]
Parameters:

color (Gdk.Color) – a Gdk.Color to set the previous color with

Sets the “previous” color to be color.

This function should be called with some hesitations, as it might seem confusing to have that color change. Calling Gtk.ColorSelection.set_current_color() will also set this color the first time it is called.

Deprecated since version 3.4: Use Gtk.ColorSelection.set_previous_rgba() instead.

set_previous_rgba(rgba)[source]
Parameters:

rgba (Gdk.RGBA) – a Gdk.RGBA to set the previous color with

Sets the “previous” color to be rgba.

This function should be called with some hesitations, as it might seem confusing to have that color change. Calling Gtk.ColorSelection.set_current_rgba() will also set this color the first time it is called.

New in version 3.0.

do_color_changed() virtual

Signal Details

Gtk.ColorSelection.signals.color_changed(color_selection)
Signal Name:

color-changed

Flags:

RUN_FIRST

Parameters:

color_selection (Gtk.ColorSelection) – The object which received the signal

This signal is emitted when the color changes in the Gtk.ColorSelection according to its update policy.

Property Details

Gtk.ColorSelection.props.current_alpha
Name:

current-alpha

Type:

int

Default Value:

65535

Flags:

READABLE, WRITABLE

The current opacity value (0 fully transparent, 65535 fully opaque)

Gtk.ColorSelection.props.current_color
Name:

current-color

Type:

Gdk.Color

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE

The current Gdk.Color color.

Deprecated since version 3.4: Use Gtk.ColorSelection :current-rgba instead.

Gtk.ColorSelection.props.current_rgba
Name:

current-rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE

The current RGBA color.

New in version 3.0.

Gtk.ColorSelection.props.has_opacity_control
Name:

has-opacity-control

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the color selector should allow setting opacity

Gtk.ColorSelection.props.has_palette
Name:

has-palette

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether a palette should be used