1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.ColorButton</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtkclipboard.html" title="gtk.Clipboard"><link rel="next" href="class-gtkcolorselection.html" title="gtk.ColorSelection"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.ColorButton</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkclipboard.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkcolorselection.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkcolorbutton"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.ColorButton</h2><p>gtk.ColorButton — a button to launch a
color selection dialog (new in PyGTK 2.4)</p></div><div class="refsect1" lang="en"><a name="id3308028"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.ColorButton</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a href="class-gtkcolorbutton.html#constructor-gtkcolorbutton" title="Constructor">gtk.ColorButton</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>color</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--set-color" title="gtk.ColorButton.set_color">set_color</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>color</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-color" title="gtk.ColorButton.get_color">get_color</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--set-alpha" title="gtk.ColorButton.set_alpha">set_alpha</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>alpha</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-alpha" title="gtk.ColorButton.get_alpha">get_alpha</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--set-use-alpha" title="gtk.ColorButton.set_use_alpha">set_use_alpha</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>use_alpha</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-use-alpha" title="gtk.ColorButton.get_use_alpha">get_use_alpha</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--set-title" title="gtk.ColorButton.set_title">set_title</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>title</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-title" title="gtk.ColorButton.get_title">get_title</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3334640"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
+-- <a href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
+-- <a href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
+-- <a href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
+-- <a href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a>
+-- <a href="class-gtkcolorbutton.html" title="gtk.ColorButton">gtk.ColorButton</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3353720"></a><h2>Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"alpha"</td><td valign="top">Read-Write</td><td valign="top">The selected opacity value (0 fully transparent, 65535
fully opaque). Available in GTK+ 2.4 and above.</td></tr><tr valign="top"><td valign="top">"color"</td><td valign="top">Read-Write</td><td valign="top">The selected color. Available in GTK+ 2.4 and above.</td></tr><tr valign="top"><td valign="top">"title"</td><td valign="top">Read-Write</td><td valign="top">The title of the color selection dialog. Available in
GTK+ 2.4 and above.</td></tr><tr valign="top"><td valign="top">"use-alpha"</td><td valign="top">Read-Write</td><td valign="top">If <tt class="literal">TRUE</tt>, 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.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3308097"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">"<a href="class-gtkcolorbutton.html#signal-gtkcolorbutton--color-set" title='The "color-set" gtk.ColorButton Signal'>color-set</a>"</span></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>colorbutton</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3329892"></a><h2>Description</h2><p>The <a href="class-gtkcolorbutton.html" title="gtk.ColorButton"><tt class="classname">gtk.ColorButton</tt></a>
is a button which displays the currently selected color and, when
clicked, opens a <a href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><tt class="classname">gtk.ColorSelectionDialog</tt></a>
to change the color. It's a suitable widget for selecting a color in a
preference dialog. The <a href="class-gtkcolorbutton.html" title="gtk.ColorButton"><tt class="classname">gtk.ColorButton</tt></a>
is available in PyGTK 2.4 and above.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkcolorbutton"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.ColorButton</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>color</tt></b></span><span class="initializer">=gtk.gdk.Color(0,0,0)</span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>color</tt></b>:</span></td><td>an optional <a href="class-gdkcolor.html" title="gtk.gdk.Color"><tt class="classname">gtk.gdk.Color</tt></a> to set the current color with</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new color button.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This constructor is available in PyGTK 2.4 and above.</p></div><p>Creates a new color button with the current color set to the color
specified by the optional <a href="class-gdkcolor.html" title="gtk.gdk.Color"><tt class="classname">gtk.gdk.Color</tt></a>
<i class="parameter"><tt>color</tt></i>. A color button is a small button containing a
swatch representing the current selected color. When the button is clicked,
a <a href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><tt class="classname">gtk.ColorSelectionDialog</tt></a>
will open, allowing the user to select a color. The swatch will be updated
to reflect the new color the user selects.</p></div><div class="refsect1" lang="en"><a name="id3331210"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--set-color"></a><h3>gtk.ColorButton.set_color</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_color</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>color</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>color</tt></b>:</span></td><td>A <a href="class-gdkcolor.html" title="gtk.gdk.Color"><tt class="classname">gtk.gdk.Color</tt></a> to set the current color with.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">set_color</tt>() method sets the current
color (and the "color" property) to the color specified by the <a href="class-gdkcolor.html" title="gtk.gdk.Color"><tt class="classname">gtk.gdk.Color</tt></a>
<i class="parameter"><tt>color</tt></i>.</p></div><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--get-color"></a><h3>gtk.ColorButton.get_color</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_color</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a <a href="class-gdkcolor.html" title="gtk.gdk.Color"><tt class="classname">gtk.gdk.Color</tt></a>
specifying the current color.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_color</tt>() method returns the
value of the "color" property which is a <a href="class-gdkcolor.html" title="gtk.gdk.Color"><tt class="classname">gtk.gdk.Color</tt></a>
specifying the current color in the <a href="class-gtkcolorbutton.html" title="gtk.ColorButton"><tt class="classname">gtk.ColorButton</tt></a>
widget.</p></div><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--set-alpha"></a><h3>gtk.ColorButton.set_alpha</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_alpha</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>alpha</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>alpha</tt></b>:</span></td><td>The opacity in the range 0 to
65535.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">set_alpha</tt>() method sets the current
opacity (and the "alpha" property) to the value specified by
<i class="parameter"><tt>alpha</tt></i>.</p></div><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--get-alpha"></a><h3>gtk.ColorButton.get_alpha</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_alpha</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the opacity in the range 0 to
65535.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_alpha</tt>() method returns the
value of the "alpha" property that contains the opacity setting.</p></div><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--set-use-alpha"></a><h3>gtk.ColorButton.set_use_alpha</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_alpha</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>use_alpha</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>use_alpha</tt></b>:</span></td><td>if <tt class="literal">TRUE</tt>, the color button
should use the alpha channel.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">set_use_alpha</tt>() method sets the
"use-alpha" property to the value of
<i class="parameter"><tt>use_alpha</tt></i>. If <i class="parameter"><tt>use_alpha</tt></i>
is <tt class="literal">TRUE</tt>, 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.</p></div><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--get-use-alpha"></a><h3>gtk.ColorButton.get_use_alpha</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_use_alpha</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the color sample
should use the alpha channel</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_use_alpha</tt>() method returns the
value of the "use-alpha" property. If <tt class="literal">TRUE</tt> the
color selection dialog should use the alpha channel.</p></div><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--set-title"></a><h3>gtk.ColorButton.set_title</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_title</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>title</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>title</tt></b>:</span></td><td>a string containing the new <a href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><tt class="classname">gtk.ColorSelectionDialog</tt></a>
title.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">set_title</tt>() method sets the title
for the color selection dialog to the string contained in
<i class="parameter"><tt>title</tt></i>. The "title" property is also set. </p></div><div class="refsect2" lang="en"><a name="method-gtkcolorbutton--get-title"></a><h3>gtk.ColorButton.get_title</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_title</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the title of the <a href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><tt class="classname">gtk.ColorSelectionDialog</tt></a></td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_title</tt>() method returns the
value of the "title" property that contains the title of the color
selection dialog.</p></div></div><div class="refsect1" lang="en"><a name="id3331339"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gtkcolorbutton--color-set"></a><h3>The "color-set" gtk.ColorButton Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>colorbutton</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>colorbutton</tt></i>:</span></td><td>the colorbutton that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This signal is available in PyGTK 2.4 and above.</p></div><p>The "color-set" signal is emitted when the user selects a
color. When handling this signal, use the <a href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-color" title="gtk.ColorButton.get_color"><tt class="methodname">get_color</tt>()</a>
and the <a href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-alpha" title="gtk.ColorButton.get_alpha"><tt class="methodname">get_alpha</tt>()</a>
methods to find out what color was just selected.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkclipboard.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gtkcolorselection.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Clipboard</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.ColorSelection</td></tr></table></div></body></html>
|