gtk.ColorSelection — a widget used to select a color.


+-- gobject.GObject
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Box
          +-- gtk.VBox
            +-- gtk.ColorSelection

Implemented Interfaces

gtk.ColorSelection implements gtk.Buildable

gtk.ColorSelection Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Box Properties

"current-alpha"Read/WriteThe current opacity value (0 fully transparent, 65535 fully opaque)
"current-color"Read/WriteThe current color as a gtk.gdk.Color
"has-opacity-control"Read/WriteIf True, the color selector should allow setting opacity
"has-palette"Read/WriteIf True, a palette should be used

gtk.ColorSelection Style Properties

gtk.Widget Style Properties

gtk.ColorSelection Child Properties

gtk.Box Child Properties

gtk.ColorSelection Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes


def callback(colorselection, user_param1, ...)


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.



Returns :

a new gtk.ColorSelection

Creates a new gtk.ColorSelection widget.



    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.


    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.


    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.


    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.


    def set_current_color(color)

color :

A gtk.gdk.Color to set the current color with.

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.


    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.


    def get_current_color()

Returns :

a gtk.gdk.Color representing the current color.

The get_current_color() method retrieves the current color in the colorselection.


    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.


    def set_previous_color(color)

color :

a gtk.gdk.Color to set the previous color with.

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.


    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.


    def get_previous_color()

Returns :

a gtk.gdk.Color with the previous color value.

The get_previous_color() method retrieves the previous color value.


    def get_previous_alpha()

Returns :

an integer between 0 and 65535.

The get_previous_alpha() method returns the previous alpha value.


    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.



    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.


    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.


The "color-changed" gtk.ColorSelection Signal

    def callback(colorselection, user_param1, ...)

colorselection :

the colorselection that received the signal

user_param1 :

the first user parameter (if any) specified with the connect() method

... :

additional user parameters (if any)

The "color-changed" signal is emitted when the current color in the colorselection changes.