Gtk.ColorChooserDialog
Gtk.ColorChooserDialog — A dialog for choosing colors
Object Hierarchy:
GObject
╰── GInitiallyUnowned
╰── Gtk.Widget
╰── Gtk.Container
╰── Gtk.Bin
╰── Gtk.Window
╰── Gtk.Dialog
╰── Gtk.ColorChooserDialog
See also:
Functions:
- new
(title:str=None, parent:Gtk.Window=None) -> Gtk.Widget
Description:
The Gtk.ColorChooserDialog
widget is a dialog for choosing a color. It implements the Gtk.ColorChooser interface.
Function Details:
new()
new (title:str=None, parent:Gtk.Window=None) -> Gtk.Widget
Creates a new Gtk.ColorChooserDialog
.
Returns: a new Gtk.ColorChooserDialog
Since: 3.4
Example:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
def color_activated():
color = colorchooserdialog.get_rgba()
red = int(color.red * 255)
green = int(color.green * 255)
blue = int(color.blue * 255)
print('Hex: #%02x%02x%02x' % (red, green, blue))
colorchooserdialog = Gtk.ColorChooserDialog()
if colorchooserdialog.run() == Gtk.ResponseType.OK:
color_activated()
colorchooserdialog.destroy()