Gtk.ColorChooser¶
- Implementations:
 Gtk.ColorButton,Gtk.ColorChooserDialog,Gtk.ColorChooserWidget
Methods¶
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
  | 
|
  | 
|
  | 
|
  | 
Properties¶
Name  | 
Type  | 
Flags  | 
Short Description  | 
|---|---|---|---|
r/w  | 
Current color, as a   | 
||
r/w/en  | 
Whether alpha should be shown  | 
Signals¶
Name  | 
Short Description  | 
|---|---|
Emitted when a color is activated from the color chooser.  | 
Fields¶
None
Class Details¶
- class Gtk.ColorChooser¶
 - Bases:
 - Structure:
 
Gtk.ColorChooseris 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
Gtk.ColorChooserWidget,Gtk.ColorChooserDialogandGtk.ColorButton.New in version 3.4.
- add_palette(orientation, colors_per_line, colors)[source]¶
 - Parameters:
 orientation (
Gtk.Orientation) –Gtk.Orientation.HORIZONTALif the palette should be displayed in rows,Gtk.Orientation.VERTICALfor columnscolors_per_line (
int) – the number of colors to show in each row/columncolors ([
Gdk.RGBA] orNone) – the colors of the palette, orNone
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
Gtk.ColorChooserWidgethas 27 colors, organized in columns of 3 colors. The default gray palette has 9 grays in a single row.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 and gray palettes from the color chooser.
If colors is
None, removes all previously added palettes.New in version 3.4.
- get_use_alpha()[source]¶
 - 
Returns whether the color chooser shows the alpha channel.
New in version 3.4.
 
- set_rgba(color)[source]¶
 - Parameters:
 color (
Gdk.RGBA) – the new color
Sets the color.
New in version 3.4.
- set_use_alpha(use_alpha)[source]¶
 - 
Sets whether or not the color chooser should use the alpha channel.
New in version 3.4.
 
- do_add_palette(orientation, colors_per_line, colors) virtual¶
 - Parameters:
 orientation (
Gtk.Orientation) –Gtk.Orientation.HORIZONTALif the palette should be displayed in rows,Gtk.Orientation.VERTICALfor columnscolors_per_line (
int) – the number of colors to show in each row/columncolors ([
Gdk.RGBA] orNone) – the colors of the palette, orNone
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
Gtk.ColorChooserWidgethas 27 colors, organized in columns of 3 colors. The default gray palette has 9 grays in a single row.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 and gray palettes from the color chooser.
If colors is
None, removes all previously added palettes.New in version 3.4.
- do_get_rgba() virtual¶
 - 
Gets the currently-selected color.
New in version 3.4.
 
Signal Details¶
- Gtk.ColorChooser.signals.color_activated(color_chooser, color)¶
 - Signal Name:
 color-activated- Flags:
 - Parameters:
 color_chooser (
Gtk.ColorChooser) – The object which received the signalcolor (
Gdk.RGBA) – the color
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.
New in version 3.4.
Property Details¶
- Gtk.ColorChooser.props.rgba¶
 - 
The
::rgbaproperty contains the currently selected color, as aGdk.RGBAstruct. The property can be set to change the current selection programmatically.New in version 3.4.
 
- Gtk.ColorChooser.props.use_alpha¶
 - Name:
 use-alpha- Type:
 - Default Value:
 - Flags:
 
When
::use-alphaisTrue, colors may have alpha (translucency) information. When it isFalse, theGdk.RGBAstruct obtained via theGtk.ColorChooser:rgbaproperty 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).
New in version 3.4.