Gtk.ColorChooser¶
interface
:::warning Deprecated since 4.10 This API is deprecated. :::
GtkColorChooser is an interface that is implemented by widgets
for choosing colors.
Depending on the situation, colors may be allowed to have alpha (translucency).
In GTK, the main widgets that implement this interface are
ColorChooserWidget, ColorChooserDialog and
ColorButton.
Methods¶
add_palette¶
def add_palette(self, orientation: Orientation | int, colors_per_line: int, colors: list[Gdk.RGBA] | None = ...) -> None
:::warning Deprecated since 4.10 This API is deprecated. :::
Adds a palette to the color chooser.
If orientation is horizontal, the colors are grouped in rows,
with colors_per_line colors in each row. If horizontal is False,
the colors are grouped in columns instead.
The default color palette of ColorChooserWidget has
45 colors, organized in columns of 5 colors (this includes some
grays).
The layout of the color chooser widget works best when the palettes have 9-10 columns.
Calling this function for the first time has the side effect of removing the default color palette from the color chooser.
If colors is None, removes all previously added palettes.
Parameters:
orientation—Orientation.HORIZONTALif the palette should be displayed in rows,Orientation.VERTICALfor columnscolors_per_line— the number of colors to show in each row/columncolors— the colors of the palette
get_rgba¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the currently-selected color.
get_use_alpha¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns whether the color chooser shows the alpha channel.
set_rgba¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the color.
Parameters:
color— the new color
set_use_alpha¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets whether or not the color chooser should use the alpha channel.
Parameters:
use_alpha—Trueif color chooser should use alpha channel,Falseif not
Virtual methods¶
do_add_palette¶
def do_add_palette(self, orientation: Orientation | int, colors_per_line: int, colors: list[Gdk.RGBA] | None = ...) -> None
:::warning Deprecated since 4.10 This API is deprecated. :::
Adds a palette to the color chooser.
If orientation is horizontal, the colors are grouped in rows,
with colors_per_line colors in each row. If horizontal is False,
the colors are grouped in columns instead.
The default color palette of ColorChooserWidget has
45 colors, organized in columns of 5 colors (this includes some
grays).
The layout of the color chooser widget works best when the palettes have 9-10 columns.
Calling this function for the first time has the side effect of removing the default color palette from the color chooser.
If colors is None, removes all previously added palettes.
Parameters:
orientation—Orientation.HORIZONTALif the palette should be displayed in rows,Orientation.VERTICALfor columnscolors_per_line— the number of colors to show in each row/columncolors— the colors of the palette
do_color_activated¶
do_get_rgba¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the currently-selected color.
do_set_rgba¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the color.
Parameters:
color— the new color
Properties¶
rgba¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The currently selected color, as a GdkRGBA struct.
The property can be set to change the current selection programmatically.
use_alpha¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Whether colors may have alpha (translucency).
When ::use-alpha is False, the GdkRGBA struct obtained
via the ColorChooser.rgba property will be
forced to have alpha == 1.
Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).
Signals¶
color-activated¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Emitted when a color is activated from the color chooser.
This usually happens when the user clicks a color swatch, or a color is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.