Gtk.ColorButton¶
Methods¶
| class | new() | 
| class | new_with_color(color) | 
| class | new_with_rgba(rgba) | 
| get_alpha() | |
| get_color() | |
| get_title() | |
| get_use_alpha() | |
| set_alpha(alpha) | |
| set_color(color) | |
| set_title(title) | |
| set_use_alpha(use_alpha) | 
Virtual Methods¶
| Inherited: | Gtk.Button (6), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Actionable (4), Gtk.Activatable (2), Gtk.ColorChooser (4) | 
|---|
| do_color_set() | 
Properties¶
| Inherited: | Gtk.Button (9), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2), Gtk.Activatable (2), Gtk.ColorChooser (2) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| alpha | int | r/w | The selected opacity value (0 fully transparent, 65535 fully opaque) | 
| color | Gdk.Color | d/r/w | The selected color deprecated | 
| show-editor | bool | r/w/en | Whether to show the color editor right away | 
| title | str | r/w | The title of the color selection dialog | 
Style Properties¶
| Inherited: | Gtk.Button (7), Gtk.Widget (17) | 
|---|
Signals¶
| Inherited: | Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Gtk.ColorChooser (1) | 
|---|
| Name | Short Description | 
|---|---|
| color-set | The ::color-setsignal is emitted when the user selects a color. | 
Fields¶
| Inherited: | Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Gtk.ColorChooser (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| button | Gtk.Button | r | 
Class Details¶
- 
class Gtk.ColorButton(*args, **kwargs)¶
- Bases: - Gtk.Button,- Gtk.ColorChooser- Abstract: - No - Structure: - Gtk.ColorButtonClass- The - Gtk.ColorButtonis a button which displays the currently selected color and allows to open a color selection dialog to change the color. It is suitable widget for selecting a color in a preference dialog.- CSS nodes
 - Gtk.ColorButtonhas a single CSS node with name button. To differentiate it from a plain- Gtk.Button, it gets the .color style class.- 
classmethod new()[source]¶
- Returns: - a new color button - Return type: - Gtk.Widget- Creates a new color button. - This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes. - New in version 2.4. 
 - 
classmethod new_with_color(color)[source]¶
- Parameters: - color ( - Gdk.Color) – A- Gdk.Colorto set the current color with- Returns: - a new color button - Return type: - Gtk.Widget- Creates a new color button. - New in version 2.4. - Deprecated since version 3.4: Use - Gtk.ColorButton.new_with_rgba() instead.
 - 
classmethod new_with_rgba(rgba)[source]¶
- Parameters: - rgba ( - Gdk.RGBA) – A- Gdk.RGBAto set the current color with- Returns: - a new color button - Return type: - Gtk.Widget- Creates a new color button. - New in version 3.0. 
 - 
get_alpha()[source]¶
- Returns: - an integer between 0 and 65535 - Return type: - int- Returns the current alpha value. - New in version 2.4. - Deprecated since version 3.4: Use - Gtk.ColorChooser.get_rgba() instead.
 - 
get_color()[source]¶
- Returns: - a - Gdk.Colorto fill in with the current color- Return type: - color: - Gdk.Color- Sets color to be the current color in the - Gtk.ColorButtonwidget.- New in version 2.4. - Deprecated since version 3.4: Use - Gtk.ColorChooser.get_rgba() instead.
 - 
get_title()[source]¶
- Returns: - An internal string, do not free the return value - Return type: - str- Gets the title of the color selection dialog. - New in version 2.4. 
 - 
get_use_alpha()[source]¶
- Returns: - Trueif the color sample uses alpha channel,- Falseif not- Return type: - bool- Does the color selection dialog use the alpha channel ? - New in version 2.4. - Deprecated since version 3.4: Use - Gtk.ColorChooser.get_use_alpha() instead.
 - 
set_alpha(alpha)[source]¶
- Parameters: - alpha ( - int) – an integer between 0 and 65535- Sets the current opacity to be alpha. - New in version 2.4. - Deprecated since version 3.4: Use - Gtk.ColorChooser.set_rgba() instead.
 - 
set_color(color)[source]¶
- Parameters: - color ( - Gdk.Color) – A- Gdk.Colorto set the current color with- Sets the current color to be color. - New in version 2.4. - Deprecated since version ???: Use - Gtk.ColorChooser.set_rgba() instead.
 - 
set_title(title)[source]¶
- Parameters: - title ( - str) – String containing new window title- Sets the title for the color selection dialog. - New in version 2.4. 
 - 
set_use_alpha(use_alpha)[source]¶
- Parameters: - use_alpha ( - bool) –- Trueif color button should use alpha channel,- Falseif not- Sets whether or not the color button should use the alpha channel. - New in version 2.4. - Deprecated since version 3.4: Use - Gtk.ColorChooser.set_use_alpha() instead.
 - 
do_color_set() virtual¶
 
Signal Details¶
- 
Gtk.ColorButton.signals.color_set(color_button)¶
- Signal Name: - color-set- Flags: - RUN_FIRST- Parameters: - color_button ( - Gtk.ColorButton) – The object which received the signal- The - ::color-setsignal is emitted when the user selects a color. When handling this signal, use gtk_color_button_get_rgba() to find out which color was just selected.- Note that this signal is only emitted when the user changes the color. If you need to react to programmatic color changes as well, use the notify::color signal. - New in version 2.4. 
Property Details¶
- 
Gtk.ColorButton.props.alpha¶
- Name: - alpha- Type: - int- Default Value: - 65535- Flags: - READABLE,- WRITABLE- The selected opacity value (0 fully transparent, 65535 fully opaque). - New in version 2.4. 
- 
Gtk.ColorButton.props.color¶
- Name: - color- Type: - Gdk.Color- Default Value: - None- Flags: - DEPRECATED,- READABLE,- WRITABLE- The selected color. - New in version 2.4. - Deprecated since version 3.4: Use - Gtk.ColorButton- :rgbainstead.
- 
Gtk.ColorButton.props.show_editor¶
- Name: - show-editor- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Set this property to - Trueto skip the palette in the dialog and go directly to the color editor.- This property should be used in cases where the palette in the editor would be redundant, such as when the color button is already part of a palette. - New in version 3.20. 
