Description
The gtk.ColorSelection
is a widget that is used to select a color. It consists of a color wheel and
entry boxes for color parameters such as hue, saturation, value, red, green,
blue, and color name and optionally an opacity control and/or a color
palette. It is found on the standard color selection dialog box gtk.ColorSelectionDialog
.
The color wheel can be manipulated to set a new color or new entries can be
made in the entry boxes. The new color is displayed next to the previous
color. An eyedropper button is available to allow the selection of a color
from a pixel location on the display.
Methods
gtk.ColorSelection.get_has_opacity_control
def get_has_opacity_control()
Returns : | True if the
colorsel has an opacity control;
False if it doesn't. |
The get_opacity
() method determines
whether the colorselection is displaying an opacity control.
gtk.ColorSelection.set_has_opacity_control
def set_has_opacity_control(has_opacity
)
has_opacity :
| If True the colorselection
will display the opacity control. |
The set_has_opacity_control
() method
sets the "has-opacity-control" property to the value of
has_opacity
. If has_opacity
is
True
the colorselection will display the opacity control
slider and entry box; otherwise the opacity control is not displayed.
gtk.ColorSelection.get_has_palette
def get_has_palette()
Returns : | True if the selector has a
palette; False if it hasn't. |
The get_has_palette
() method returns
the value of the "has-palette" property that determines whether the color
selector displays a color palette.
gtk.ColorSelection.set_has_palette
def set_has_palette(has_palette
)
has_palette :
| If True the color palette is
displayed. |
The set_has_palette
() method sets the
"has-palette" property to the value of has_palette
.
If has_palette
is True the palette will be displayed;
otherwise the palette will be hidden.
gtk.ColorSelection.set_current_color
def set_current_color(color
)
The set_current_color
() method sets the
current color to the value of color
. The first time
this is called, it will also set the previous color to the value of
color
too.
gtk.ColorSelection.set_current_alpha
def set_current_alpha(alpha
)
alpha :
| an integer between 0 and
65535. |
The set_current_alpha
() method sets the
"current-alpha" property (the opacity) to the value of alpha. The alpha
(opacity) is displayed in the range of 0 to 255 in the colorselection. The
first time this is called, it will also set the previous opacity to the
value of alpha
too.
gtk.ColorSelection.get_current_color
def get_current_color()
The get_current_color
() method
retrieves the current color in the colorselection.
gtk.ColorSelection.get_current_alpha
def get_current_alpha()
Returns : | the current alpha value in the range 0 to
65535. |
The get_current_alpha
() method returns
the value of the "current_alpha" property that controls the opacity
value.
gtk.ColorSelection.set_previous_color
def set_previous_color(color
)
The set_previous_color
() method sets
the 'previous' color to the value of color
.
Applications usually do not call this method. The first time set_current_color
()
the 'previous' color will be set.
gtk.ColorSelection.set_previous_alpha
def set_previous_alpha(alpha
)
alpha :
| an integer between 0 and
65535. |
The set_previous_alpha() method sets the 'previous' alpha to the
value of alpha
. Applications usually do not call this
method. The first time set_current_alpha
()
the 'previous' alpha will be set.
gtk.ColorSelection.get_previous_color
def get_previous_color()
The get_previous_color
() method
retrieves the previous color value.
gtk.ColorSelection.get_previous_alpha
def get_previous_alpha()
Returns : | an integer between 0 and
65535. |
The get_previous_alpha() method returns the previous alpha
value.
gtk.ColorSelection.is_adjusting
def is_adjusting()
Returns : | True if the user is
currently dragging a color around, and False if the
selection has stopped. |
The is_adjusting
() method retrieves the
current state of the colorselection. If True the user is in the process of
changing the current color.
Functions
gtk.color_selection_palette_from_string
def gtk.color_selection_palette_from_string(str
)
str :
| the string containing the list of
colors |
Returns : | a list of gtk.gdk.Color objects
or None if the conversion fails |
The
gtk.color_selection_palette_from_string
() function
returns a list of gtk.gdk.Color
objects
corresponding to the color specifications in the string specified by
str
. str is a colon-separated list of color names
readable by gtk.gtk.color_parse
().
If str
cannot be converted to a list of color this
function returns None
.
gtk.color_selection_palette_to_string
def gtk.color_selection_palette_to_string(colors
)
colors :
| a list or tuple of gtk.gdk.Color
objects |
Returns : | a string containing a colon-separated list of
colors |
The gtk.color_selection_palette_to_string
()
function returns a string containing a colon-separated list of the
representation of the gtk.gdk.Color
objects
in colors
.
This function is useful to save a special palette of colors for
a gtk.ColorSelection
as a string that can later be used by calling the gobject.set_property
()
method to set the "gtk-color-palette" property on the default gtk.Settings
returned from the gtk.settings_get_default
())
function.