Gtk.ColorDialogButton

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ColorDialogButton Gtk.ColorDialogButton Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Gtk.ColorDialogButton

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (dialog)

get_dialog ()

get_rgba ()

set_dialog (dialog)

set_rgba (color)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

dialog

Gtk.ColorDialog

r/w/en

rgba

Gdk.RGBA

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

activate

Emitted when the color dialog button is activated.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.ColorDialogButton(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Gtk.ColorDialogButtonClass

The GtkColorDialogButton is a wrapped around a [class`Gtk`.ColorDialog] and allows to open a color chooser dialog to change the color.

An example Gtk.ColorDialogButton

It is suitable widget for selecting a color in a preference dialog.

CSS nodes

`` colorbutton ╰── button.color

╰── [content]

``

GtkColorDialogButton 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.

New in version 4.10.

classmethod new(dialog)[source]
Parameters:

dialog (Gtk.ColorDialog or None) – the GtkColorDialog to use

Returns:

the new GtkColorDialogButton

Return type:

Gtk.Widget

Creates a new GtkColorDialogButton with the given GtkColorDialog.

You can pass NULL to this function and set a GtkColorDialog later. The button will be insensitive until that happens.

New in version 4.10.

get_dialog()[source]
Returns:

the GtkColorDialog

Return type:

Gtk.ColorDialog or None

Returns the GtkColorDialog of self.

New in version 4.10.

get_rgba()[source]
Returns:

the color

Return type:

Gdk.RGBA

Returns the color of the button.

This function is what should be used to obtain the color that was chosen by the user. To get informed about changes, listen to “notify::color”.

New in version 4.10.

set_dialog(dialog)[source]
Parameters:

dialog (Gtk.ColorDialog) – the new GtkColorDialog

Sets a GtkColorDialog object to use for creating the color chooser dialog that is presented when the user clicks the button.

New in version 4.10.

set_rgba(color)[source]
Parameters:

color (Gdk.RGBA) – the new color

Sets the color of the button.

New in version 4.10.

Signal Details

Gtk.ColorDialogButton.signals.activate(color_dialog_button)
Signal Name:

activate

Flags:

RUN_FIRST, ACTION

Parameters:

color_dialog_button (Gtk.ColorDialogButton) – The object which received the signal

Emitted when the color dialog button is activated.

The ::activate signal on GtkColorDialogButton is an action signal and emitting it causes the button to pop up its dialog.

New in version 4.14.

Property Details

Gtk.ColorDialogButton.props.dialog
Name:

dialog

Type:

Gtk.ColorDialog

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The GtkColorDialog that contains parameters for the color chooser dialog.

New in version 4.10.

Gtk.ColorDialogButton.props.rgba
Name:

rgba

Type:

Gdk.RGBA

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The selected color.

This property can be set to give the button its initial color, and it will be updated to reflect the users choice in the color chooser dialog.

Listen to notify::rgba to get informed about changes to the buttons color.

New in version 4.10.