manpagez: man pages & more
html files: pygtk
Home | html | info | man
gtk.ColorButton — a button to launch a color selection dialog (new in PyGTK 2.4)

Synopsis

class gtk.ColorButton(gtk.Button):
    gtk.ColorButton(color=gtk.gdk.Color(0,0,0))
def set_color(color)
def get_color()
def set_alpha(alpha)
def get_alpha()
def set_use_alpha(use_alpha)
def get_use_alpha()
def set_title(title)
def get_title()

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Bin
          +-- gtk.Button
            +-- gtk.ColorButton

Implemented Interfaces

gtk.ColorButton implements gtk.Buildable

gtk.ColorButton Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Button Properties

"alpha"Read-WriteThe selected opacity value (0 fully transparent, 65535 fully opaque). Available in GTK+ 2.4 and above.
"color"Read-WriteThe selected color. Available in GTK+ 2.4 and above.
"title"Read-WriteThe title of the color selection dialog. Available in GTK+ 2.4 and above.
"use-alpha"Read-WriteIf 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. Available in GTK+ 2.4 and above.

gtk.ColorButton Style Properties

gtk.Widget Style Properties

gtk.Button Style Properties

gtk.ColorButton Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

gtk.Button Signal Prototypes

"color-set"

def callback(colorbutton, user_param1, ...)

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

    def set_color(color)

color :

A gtk.gdk.Color to set the current color with.

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

    def get_color()

Returns :

a gtk.gdk.Color specifying the current 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

    def set_alpha(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

    def 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

    def 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

    def set_title(title)

title :

a string containing the new gtk.ColorSelectionDialog 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

    def get_title()

Returns :

the title of the gtk.ColorSelectionDialog

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.

© manpagez.com 2000-2017
Individual documents may contain additional copyright information.