The ColorChooser interface is implemented by ColorChooserDialog, ColorChooserWidget and ColorButton to allow a user to select a colour.


By default, only colours can be selected within the ColorChooser. To enable setting of transparency call:


When use_alpha is set to True, a slider appears within the dialog to control the amount of transparency.

To retrieve the colour from the ColorChooser use:


The .get_color() method returns a GdkColor object with associated values for red, green and blue. Alternatively, if your ColorChooser allows the selection of transparency values then .get_rgba() can be used. This also returns values for red, green and blue, and the transparency value, and is known as an GdkRGBA object. All the values returned are between 0.0 and 1.0.

Colours can also be set specifically on the ColorChooser with:


The color and rgba parameters should be set to the appropriate GdkColor or GdkRGBA objects which specify the values to be used.


The common signals of the ColorChooser are:

"color-activated" (chooser, color)

The color value is returned when the user activates the colour in the chooser, emitting the "color-activated" signal.


To view an example of the ColorChooser, see the code for the objects ColorChooserWidget, ColorChooserDialog, and ColorButton.