gtk.ColorButton
gtk.ColorButton — a button to launch a
color selection dialog (new in PyGTK 2.4)
Description
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.
Constructor
gtk.ColorButton(color=gtk.gdk.Color(0,0,0))
|
color : | an optional gtk.gdk.Color to set the current color with |
Returns : | a new color button. |
Note
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.
Methods
gtk.ColorButton.set_color
Note
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.
gtk.ColorButton.get_color
Note
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.
gtk.ColorButton.set_alpha
alpha : | The opacity in the range 0 to
65535. |
Note
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.
gtk.ColorButton.get_alpha
Returns : | the opacity in the range 0 to
65535. |
Note
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.
gtk.ColorButton.set_use_alpha
def set_use_alpha(use_alpha)
|
use_alpha : | if TRUE, the color button
should use the alpha channel. |
Note
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.
gtk.ColorButton.get_use_alpha
Returns : | TRUE if the color sample
should use the alpha channel |
Note
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.
gtk.ColorButton.set_title
Note
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.
gtk.ColorButton.get_title
Note
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.
Signals
The "color-set" gtk.ColorButton Signal
def callback(colorbutton, user_param1, ...)
|
colorbutton : | the colorbutton that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
Note
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.