ColorChooser#
Deprecated since version 4.10: Use ColorDialog and ColorDialogButton
instead of widgets implementing GtkColorChooser
- class ColorChooser(*args, **kwargs)#
Implementations: ColorButton, ColorChooserDialog, ColorChooserWidget
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#
- class ColorChooser
- add_palette(orientation: Orientation, colors_per_line: int, colors: list[RGBA] | None = None) None#
Adds a palette to the color chooser.
If
orientationis horizontal, the colors are grouped in rows, withcolors_per_linecolors in each row. IfhorizontalisFalse, the colors are grouped in columns instead.The default color palette of
ColorChooserWidgethas 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
colorsisNone, removes all previously added palettes.Deprecated since version 4.10: Use
ColorDialoginstead- Parameters:
orientation –
HORIZONTALif the palette should be displayed in rows,VERTICALfor columnscolors_per_line – the number of colors to show in each row/column
colors – the colors of the palette
- get_rgba() RGBA#
Gets the currently-selected color.
Deprecated since version 4.10: Use
ColorDialoginstead
- get_use_alpha() bool#
Returns whether the color chooser shows the alpha channel.
Deprecated since version 4.10: Use
ColorDialoginstead
- set_rgba(color: RGBA) None#
Sets the color.
Deprecated since version 4.10: Use
ColorDialoginstead- Parameters:
color – the new color
- set_use_alpha(use_alpha: bool) None#
Sets whether or not the color chooser should use the alpha channel.
Deprecated since version 4.10: Use
ColorDialoginstead- Parameters:
use_alpha –
Trueif color chooser should use alpha channel,Falseif not
Properties#
- class ColorChooser
- props.rgba: RGBA#
The currently selected color, as a
GdkRGBAstruct.The property can be set to change the current selection programmatically.
Deprecated since version 4.10: Use
ColorDialogandColorDialogButtoninstead of widgets implementingGtkColorChooser
- props.use_alpha: bool#
Whether colors may have alpha (translucency).
When ::use-alpha is
False, theGdkRGBAstruct obtained via thergbaproperty 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).
Deprecated since version 4.10: Use
ColorDialogandColorDialogButtoninstead of widgets implementingGtkColorChooser
Signals#
- class ColorChooser.signals
- color_activated(color: RGBA) None#
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.
Deprecated since version 4.10: Use
ColorDialogandColorDialogButtoninstead of widgets implementingGtkColorChooser- Parameters:
color – the color
Virtual Methods#
- class ColorChooser
- do_add_palette(orientation: Orientation, colors_per_line: int, colors: list[RGBA] | None = None) None#
Adds a palette to the color chooser.
If
orientationis horizontal, the colors are grouped in rows, withcolors_per_linecolors in each row. IfhorizontalisFalse, the colors are grouped in columns instead.The default color palette of
ColorChooserWidgethas 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
colorsisNone, removes all previously added palettes.Deprecated since version 4.10: Use
ColorDialoginstead- Parameters:
orientation –
HORIZONTALif the palette should be displayed in rows,VERTICALfor columnscolors_per_line – the number of colors to show in each row/column
colors – the colors of the palette
- do_get_rgba() RGBA#
Gets the currently-selected color.
Deprecated since version 4.10: Use
ColorDialoginstead
- do_set_rgba(color: RGBA) None#
Sets the color.
Deprecated since version 4.10: Use
ColorDialoginstead- Parameters:
color – the new color