Gtk.ColorChooser¶
| Implementations: | |
|---|---|
| Gtk.ColorButton,Gtk.ColorChooserDialog,Gtk.ColorChooserWidget | |
Methods¶
| add_palette(orientation, colors_per_line, colors) | |
| get_rgba() | |
| get_use_alpha() | |
| set_rgba(color) | |
| set_use_alpha(use_alpha) | 
Virtual Methods¶
| do_add_palette(orientation, colors_per_line, colors) | |
| do_color_activated(color) | |
| do_get_rgba() | |
| do_set_rgba(color) | 
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| rgba | Gdk.RGBA | r/w | Current color, as a Gdk.RGBA | 
| use-alpha | bool | r/w/en | Whether alpha should be shown | 
Signals¶
| Name | Short Description | 
|---|---|
| color-activated | Emitted when a color is activated from the color chooser. | 
Fields¶
None
Class Details¶
- 
class Gtk.ColorChooser¶
- Bases: - GObject.GInterface- Structure: - Gtk.ColorChooserInterface- 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.ColorChooserDialogand- Gtk.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 columns
- colors_per_line (int) – the number of colors to show in each row/column
- colors ([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. 
- orientation (
 - 
get_rgba()[source]¶
- Returns: - a - Gdk.RGBAto fill in with the current color- Return type: - color: - Gdk.RGBA- Gets the currently-selected color. - New in version 3.4. 
 - 
get_use_alpha()[source]¶
- Returns: - Trueif the color chooser uses the alpha channel,- Falseif not- Return type: - bool- 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]¶
- Parameters: - use_alpha ( - bool) –- Trueif color chooser should use alpha channel,- Falseif not- 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 columns
- colors_per_line (int) – the number of colors to show in each row/column
- colors ([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. 
- orientation (
 
- 
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 signal
- color (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. 
- color_chooser (
Property Details¶
- 
Gtk.ColorChooser.props.rgba¶
- Name: - rgba- Type: - Gdk.RGBA- Default Value: - None- Flags: - READABLE,- WRITABLE- The - ::rgbaproperty contains the currently selected color, as a- Gdk.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: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- When - ::use-alphais- True, colors may have alpha (translucency) information. When it is- False, the- Gdk.RGBAstruct obtained via the- Gtk.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.