:right-sidebar: True ColorDialogButton =================================================================== .. currentmodule:: gi.repository.Gtk .. versionadded:: 4.10 .. class:: ColorDialogButton(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` The ``GtkColorDialogButton`` is a wrapped around a :obj:`~gi.repository.Gtk.ColorDialog` and allows to open a color chooser dialog to change the color. .. image:: https://docs.gtk.org/gtk4/color-button.png It is suitable widget for selecting a color in a preference dialog. CSS nodes -------------------------------------------------------------------------------- .. code-block:: :dedent: 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. Constructors ------------ .. rst-class:: interim-class .. class:: ColorDialogButton :no-index: .. classmethod:: new(dialog: ~gi.repository.Gtk.ColorDialog | None = None) -> ~gi.repository.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. .. versionadded:: 4.10 :param dialog: the ``GtkColorDialog`` to use Methods ------- .. rst-class:: interim-class .. class:: ColorDialogButton :no-index: .. method:: get_dialog() -> ~gi.repository.Gtk.ColorDialog | None Returns the ``GtkColorDialog`` of ``self``\. .. versionadded:: 4.10 .. method:: get_rgba() -> ~gi.repository.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::rgba". .. versionadded:: 4.10 .. method:: set_dialog(dialog: ~gi.repository.Gtk.ColorDialog) -> None Sets a ``GtkColorDialog`` object to use for creating the color chooser dialog that is presented when the user clicks the button. .. versionadded:: 4.10 :param dialog: the new ``GtkColorDialog`` .. method:: set_rgba(color: ~gi.repository.Gdk.RGBA) -> None Sets the color of the button. .. versionadded:: 4.10 :param color: the new color Properties ---------- .. rst-class:: interim-class .. class:: ColorDialogButton :no-index: .. attribute:: props.dialog :type: ~gi.repository.Gtk.ColorDialog The type of the None singleton. .. versionadded:: 4.10 .. attribute:: props.rgba :type: ~gi.repository.Gdk.RGBA The type of the None singleton. .. versionadded:: 4.10 Signals ------- .. rst-class:: interim-class .. class:: ColorDialogButton.signals :no-index: .. method:: activate() -> None 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. .. versionadded:: 4.14