Gtk.ColorButton¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Button (29), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Actionable (5), Gtk.Activatable (6), Gtk.ColorChooser (5)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
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 |
---|---|---|---|
r/w |
The selected opacity value (0 fully transparent, 65535 fully opaque) |
||
d/r/w |
The selected color |
||
r/w/en |
Whether to show the color editor right away |
||
r/w |
The title of the color selection dialog |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Gtk.ColorChooser (1)
Name |
Short Description |
---|---|
The |
Fields¶
- Inherited:
Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Gtk.ColorChooser (1)
Name |
Type |
Access |
Description |
---|---|---|---|
button |
r |
Class Details¶
- class Gtk.ColorButton(*args, **kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
Gtk.ColorButton
is 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.ColorButton
has a single CSS node with name button. To differentiate it from a plainGtk.Button
, it gets the .color style class.- classmethod new()[source]¶
- Returns:
a new color button
- Return type:
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
) – AGdk.Color
to set the current color with- Returns:
a new color button
- Return type:
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:
- Returns:
a new color button
- Return type:
Creates a new color button.
New in version 3.0.
- get_alpha()[source]¶
- Returns:
an integer between 0 and 65535
- Return type:
Returns the current alpha value.
New in version 2.4.
Deprecated since version 3.4: Use
Gtk.ColorChooser.get_rgba
() instead.
- get_color()[source]¶
-
Sets color to be the current color in the
Gtk.ColorButton
widget.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:
Gets the title of the color selection dialog.
New in version 2.4.
- get_use_alpha()[source]¶
-
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]¶
-
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]¶
-
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:
- Parameters:
color_button (
Gtk.ColorButton
) – The object which received the signal
The
::color-set
signal 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¶
-
The selected opacity value (0 fully transparent, 65535 fully opaque).
New in version 2.4.
- Gtk.ColorButton.props.color¶
- Name:
color
- Type:
- Default Value:
- Flags:
The selected color.
New in version 2.4.
Deprecated since version 3.4: Use
Gtk.ColorButton
:rgba
instead.
- Gtk.ColorButton.props.show_editor¶
- Name:
show-editor
- Type:
- Default Value:
- Flags:
Set this property to
True
to 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.