ColorButton
Deprecated since version 4.10: Use ColorDialogButton
instead
Superclasses: Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ColorChooser
, ConstraintTarget
The GtkColorButton
allows to open a color chooser dialog to change
the color.
It is suitable widget for selecting a color in a preference dialog.
CSS nodes
colorbutton
╰── button.color
╰── [content]
GtkColorButton
has a single CSS node with name colorbutton which
contains a button node. To differentiate it from a plain GtkButton
,
it gets the .color style class.
Constructors
- class ColorButton
- classmethod new() → 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 chooser dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.
Deprecated since version 4.10: Use
ColorDialogButton
instead
Methods
- class ColorButton
- get_modal() → bool
Gets whether the dialog is modal.
Deprecated since version 4.10: Use
ColorDialogButton
instead
- get_title() → str
Gets the title of the color chooser dialog.
Deprecated since version 4.10: Use
ColorDialogButton
instead
- set_modal(modal: bool) → None
Sets whether the dialog should be modal.
Deprecated since version 4.10: Use
ColorDialogButton
instead- Parameters:
modal –
True
to make the dialog modal
- set_title(title: str) → None
Sets the title for the color chooser dialog.
Deprecated since version 4.10: Use
ColorDialogButton
instead- Parameters:
title – String containing new window title
Properties
Signals
- class ColorButton.signals
- activate() → None
Emitted to when the color button is activated.
The
::activate
signal onGtkMenuButton
is an action signal and emitting it causes the button to pop up its dialog.Added in version 4.4.
- color_set() → None
Emitted when the user selects a color.
When handling this signal, use
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::rgba signal.