Gtk.ColorChooser¶
- Implementations:
Gtk.ColorButton
,Gtk.ColorChooserDialog
,Gtk.ColorChooserWidget
Methods¶
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
|
||
r/w/en |
|
Signals¶
Name |
Short Description |
---|---|
Emitted when a color is activated from the color chooser. |
Fields¶
None
Class Details¶
- class Gtk.ColorChooser¶
- Bases:
- Structure:
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 [class`Gtk`.ColorChooserWidget], [class`Gtk`.ColorChooserDialog] and [class`Gtk`.ColorButton].
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing
GtkColorChooser
- add_palette(orientation, colors_per_line, colors)[source]¶
- Parameters:
orientation (
Gtk.Orientation
) –Gtk.Orientation.HORIZONTAL
if the palette should be displayed in rows,Gtk.Orientation.VERTICAL
for columnscolors_per_line (
int
) – the number of colors to show in each row/column
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 [class`Gtk`.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.Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead
- get_rgba()[source]¶
- Returns:
a
GdkRGBA
to fill in with the current color- Return type:
color:
Gdk.RGBA
Gets the currently-selected color.
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead
- get_use_alpha()[source]¶
-
Returns whether the color chooser shows the alpha channel.
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead
- set_rgba(color)[source]¶
- Parameters:
color (
Gdk.RGBA
) – the new color
Sets the color.
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead
- set_use_alpha(use_alpha)[source]¶
-
Sets whether or not the color chooser should use the alpha channel.
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead
- do_add_palette(orientation, colors_per_line, colors) virtual¶
- Parameters:
orientation (
Gtk.Orientation
) –Gtk.Orientation.HORIZONTAL
if the palette should be displayed in rows,Gtk.Orientation.VERTICAL
for columnscolors_per_line (
int
) – the number of colors to show in each row/column
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 [class`Gtk`.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.Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] instead
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.
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing
GtkColorChooser
Property Details¶
- Gtk.ColorChooser.props.rgba¶
-
The currently selected color, as a
GdkRGBA
struct.The property can be set to change the current selection programmatically.
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing
GtkColorChooser
- Gtk.ColorChooser.props.use_alpha¶
- Name:
use-alpha
- Type:
- Default Value:
- Flags:
Whether colors may have alpha (translucency).
When
::use-alpha
isFalse
, theGdkRGBA
struct obtained via the [property`Gtk`.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).
Deprecated since version 4.10: Use [class`Gtk`.ColorDialog] and [class`Gtk`.ColorDialogButton] instead of widgets implementing
GtkColorChooser