gtk.ColorButton — a button to launch a color selection dialog (new in PyGTK 2.4)
class gtk.ColorButton(gtk.Button): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Bin +-- gtk.Button +-- gtk.ColorButton
|
gtk.Container Signal Prototypes
def callback( |
The gtk.ColorButton
is a button that displays the currently selected color and, when
clicked, opens a gtk.ColorSelectionDialog
to change the color. It's a suitable widget for selecting a color in a
preference dialog. The gtk.ColorButton
is available in PyGTK 2.4 and above.
gtk.ColorButton(color=gtk.gdk.Color(0,0,0))
| an optional gtk.gdk.Color to set the current color with |
Returns : | a new color button. |
This constructor is available in PyGTK 2.4 and above.
Creates a new color button with the current color set to the color
specified by the optional gtk.gdk.Color
color. A color button is a small button containing a
swatch representing the current selected color. When the button is clicked,
a gtk.ColorSelectionDialog
will open, allowing the user to select a color. The swatch will be updated
to reflect the new color the user selects.
def set_color(color)
| A gtk.gdk.Color to set the current color with. |
This method is available in PyGTK 2.4 and above.
The set_color() method sets the current
color (and the "color" property) to the color specified by the gtk.gdk.Color
color.
def get_color()Returns : | a gtk.gdk.Color
specifying the current color. |
This method is available in PyGTK 2.4 and above.
The get_color() method returns the
value of the "color" property which is a gtk.gdk.Color
specifying the current color in the gtk.ColorButton
widget.
def set_alpha(alpha)
| The opacity in the range 0 to 65535. |
This method is available in PyGTK 2.4 and above.
The set_alpha() method sets the current
opacity (and the "alpha" property) to the value specified by
alpha.
def get_alpha()Returns : | the opacity in the range 0 to 65535. |
This method is available in PyGTK 2.4 and above.
The get_alpha() method returns the
value of the "alpha" property that contains the opacity setting.
def set_use_alpha(use_alpha)
| if True, the color button
should use the alpha channel. |
This method is available in PyGTK 2.4 and above.
The set_use_alpha() method sets the
"use-alpha" property to the value of
use_alpha. If use_alpha
is True, the color swatch on the button is rendered
against a checkerboard background to show its opacity and the opacity
slider is displayed in the color selection dialog.
def get_use_alpha()Returns : | True if the color sample
should use the alpha channel |
This method is available in PyGTK 2.4 and above.
The get_use_alpha() method returns the
value of the "use-alpha" property. If True the
color selection dialog should use the alpha channel.
def set_title(title)
| a string containing the new gtk.ColorSelectionDialog
title. |
This method is available in PyGTK 2.4 and above.
The set_title() method sets the title
for the color selection dialog to the string contained in
title. The "title" property is also set.
def get_title()Returns : | the title of the gtk.ColorSelectionDialog |
This method is available in PyGTK 2.4 and above.
The get_title() method returns the
value of the "title" property that contains the title of the color
selection dialog.
def callback(colorbutton, user_param1, ...)
| the colorbutton that received the signal |
| the first user parameter (if any) specified
with the connect() |
| additional user parameters (if any) |
This signal is available in PyGTK 2.4 and above.
The "color-set" signal is emitted when the user selects a
color. When handling this signal, use the get_color()
and the get_alpha()
methods to find out what color was just selected.