Gtk.ColorChooser
Gtk.ColorChooser — Interface implemented by widgets for choosing colors
Object Hierarchy:
GInterface
╰── Gtk.ColorChooser
See also:
Gtk.ColorChooserDialog, Gtk.ColorChooserWidget, Gtk.ColorButton
Functions:
- get_rgba
(self) -> color:Gdk.RGBA
- set_rgba
(self, color:Gdk.RGBA)
- get_use_alpha
(self) -> bool
- set_use_alpha
(self, use_alpha:bool)
- add_palette
(self, orientation:Gtk.Orientation, colors_per_line:int, colors:list=None)
Description:
Gtk.ColorChooser
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 GtkColorChooserWidget, Gtk.ColorChooserDialog and GtkColorButton.
Function Details:
get_rgba()
get_rgba (self) -> color:Gdk.RGBA
Gets the currently-selected color.
- Since: 3.4
set_rgba()
set_rgba (self, color:Gdk.RGBA)
Sets the color.
- Since: 3.4
get_use_alpha()
get_use_alpha (self) -> bool
Returns whether the color chooser shows the alpha channel.
Returns:
True
if the color chooser uses the alpha channel,FALSE
if notSince: 3.4
set_use_alpha()
set_use_alpha (self, use_alpha:bool)
Sets whether or not the color chooser should use the alpha channel.
- Since: 3.4
add_palette()
add_palette (self, orientation:Gtk.Orientation, colors_per_line:int, colors:list=None)
Adds a palette to the color chooser. If orientation
is horizontal,the colors are grouped in rows, with colors_per_line
colorsin each row. If horizontal
is FALSE
, the colors are groupedin columns instead.
The default color palette of Gtk.ColorChooserWidget
has27 colors, organized in columns of 3 colors. The default graypalette has 9 grays in a single row.
The layout of the color chooser widget works best when thepalettes have 9-10 columns.
Calling this function for the first time has theside effect of removing the default color and gray palettesfrom the color chooser.
If colors
is None
, removes all previously added palettes.
- Since: 3.4