ColorButton (Python) Marta Maria Casetti mmcasetti@gmail.com 2012 A button to launch a color selection dialog ColorButton

This ColorButton launches a color selection dialog and prints in the terminal the RGB values of the color selected.

Code used to generate this example
Useful methods for a ColorButton widget

set_color(color), where the color is defined as in the example, sets the color of the ColorButton, which by default is black. get_color() returns the color.

In line 23 the "color-set" signal is connected to the callback function on_color_chosen() using widget.connect(signal, callback function). See for a more detailed explanation.

API References

In this sample we used the following:

GtkColorButton

GtkColorChooser

RGBA Colors