File: class-gtkcolorbutton.html

package info (click to toggle)
pygtk 2.24.0-5.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 26,760 kB
  • ctags: 8,260
  • sloc: xml: 182,079; sh: 10,297; python: 10,161; ansic: 2,861; makefile: 1,358
file content (62 lines) | stat: -rw-r--r-- 23,595 bytes parent folder | download | duplicates (3)
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
59
60
61
62
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.ColorButton</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><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="prev" 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" title="gtk.ColorButton"><a name="class-gtkcolorbutton"></a><div class="titlepage"></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" title="Synopsis"><a name="id3645954"></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 class="link" href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a class="link" href="class-gtkcolorbutton.html#constructor-gtkcolorbutton" title="Constructor">gtk.ColorButton</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>color</code></strong></span><span class="initializer">=gtk.gdk.Color(0,0,0)</span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkcolorbutton.html#method-gtkcolorbutton--set-color" title="gtk.ColorButton.set_color">set_color</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>color</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" 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 class="link" href="class-gtkcolorbutton.html#method-gtkcolorbutton--set-alpha" title="gtk.ColorButton.set_alpha">set_alpha</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" 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 class="link" 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"><strong class="parameter"><code>use_alpha</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" 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 class="link" href="class-gtkcolorbutton.html#method-gtkcolorbutton--set-title" title="gtk.ColorButton.set_title">set_title</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>title</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" 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" title="Ancestry"><a name="id3646170"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
  +-- <a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
    +-- <a class="link" href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
      +-- <a class="link" href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
        +-- <a class="link" href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
          +-- <a class="link" href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a>
            +-- <a class="link" href="class-gtkcolorbutton.html" title="gtk.ColorButton">gtk.ColorButton</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3646218"></a><h2>Implemented Interfaces</h2><p>
			<a class="link" href="class-gtkcolorbutton.html" title="gtk.ColorButton"><code class="classname">gtk.ColorButton</code></a>
			implements 
			<a class="link" href="class-gtkbuildable.html" title="gtk.Buildable"><code class="classname">gtk.Buildable</code></a>
		</p></div><div class="refsect1" title="gtk.ColorButton Properties"><a name="properties-gtkcolorbutton"></a><h2>gtk.ColorButton Properties</h2><p><a class="link" href="class-gtkobject.html#properties-gtkobject" title="gtk.Object Properties">gtk.Object Properties</a></p><p><a class="link" href="class-gtkwidget.html#properties-gtkwidget" title="gtk.Widget Properties">gtk.Widget Properties</a></p><p><a class="link" href="class-gtkcontainer.html#properties-gtkcontainer" title="gtk.Container Properties">gtk.Container Properties</a></p><p><a class="link" href="class-gtkbutton.html#properties-gtkbutton" title="gtk.Button Properties">gtk.Button Properties</a></p><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></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 <code class="literal">True</code>, 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" title="gtk.ColorButton Style Properties"><a name="style-properties-gtkcolorbutton"></a><h2>gtk.ColorButton Style Properties</h2><p><a class="link" href="class-gtkwidget.html#style-properties-gtkwidget" title="gtk.Widget Style Properties">gtk.Widget Style Properties</a></p><p><a class="link" href="class-gtkbutton.html#style-properties-gtkbutton" title="gtk.Button Style Properties">gtk.Button Style Properties</a></p></div><div class="refsect1" title="gtk.ColorButton Signal Prototypes"><a name="signal-prototypes-gtkcolorbutton"></a><h2>gtk.ColorButton Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p><p><a class="link" href="class-gtkobject.html#signal-prototypes-gtkobject" title="gtk.Object Signal Prototypes">gtk.Object Signal Prototypes</a></p><p><a class="link" href="class-gtkwidget.html#signal-prototypes-gtkwidget" title="gtk.Widget Signal Prototypes">gtk.Widget Signal Prototypes</a></p><p><a class="link" href="class-gtkcontainer.html#signal-prototypes-gtkcontainer" title="gtk.Container Signal Prototypes">gtk.Container Signal Prototypes</a></p><p><a class="link" href="class-gtkbutton.html#signal-prototypes-gtkbutton" title="gtk.Button Signal Prototypes">gtk.Button Signal Prototypes</a></p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gtkcolorbutton.html#signal-gtkcolorbutton--color-set" title='The "color-set" gtk.ColorButton Signal'>color-set</a>"</span></p></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>colorbutton</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" title="Description"><a name="id3646502"></a><h2>Description</h2><p>The <a class="link" href="class-gtkcolorbutton.html" title="gtk.ColorButton"><code class="classname">gtk.ColorButton</code></a>
    is a button that displays the currently selected color and, when
    clicked, opens a <a class="link" href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><code class="classname">gtk.ColorSelectionDialog</code></a>
    to change the color. It's a suitable widget for selecting a color in a
    preference dialog. The <a class="link" href="class-gtkcolorbutton.html" title="gtk.ColorButton"><code class="classname">gtk.ColorButton</code></a>
    is available in PyGTK 2.4 and above.</p></div><div class="refsect1" title="Constructor"><a name="constructor-gtkcolorbutton"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.ColorButton</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>color</code></strong></span><span class="initializer">=gtk.gdk.Color(0,0,0)</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>color</code></strong> :</span></p></td><td>an optional <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a> to set the current color with</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new color button.</td></tr></tbody></table><div class="note" title="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 class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
<em class="parameter"><code>color</code></em>. A color button is a small button containing a
swatch representing the current selected color. When the button is clicked,
a <a class="link" href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><code class="classname">gtk.ColorSelectionDialog</code></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" title="Methods"><a name="id3646642"></a><h2>Methods</h2><div class="refsect2" title="gtk.ColorButton.set_color"><a name="method-gtkcolorbutton--set-color"></a><h3>gtk.ColorButton.set_color</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_color</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>color</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>color</code></strong> :</span></p></td><td>A <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a> to set the current color with.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">set_color</code>() method sets the current
      color (and the "color" property) to the color specified by the <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
      <em class="parameter"><code>color</code></em>.</p></div><div class="refsect2" title="gtk.ColorButton.get_color"><a name="method-gtkcolorbutton--get-color"></a><h3>gtk.ColorButton.get_color</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_color</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
	  specifying the current color.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">get_color</code>() method returns the
      value of the "color" property which is a <a class="link" href="class-gdkcolor.html" title="gtk.gdk.Color"><code class="classname">gtk.gdk.Color</code></a>
      specifying the current color in the <a class="link" href="class-gtkcolorbutton.html" title="gtk.ColorButton"><code class="classname">gtk.ColorButton</code></a>
      widget.</p></div><div class="refsect2" title="gtk.ColorButton.set_alpha"><a name="method-gtkcolorbutton--set-alpha"></a><h3>gtk.ColorButton.set_alpha</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_alpha</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>alpha</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>alpha</code></strong> :</span></p></td><td>The opacity in the range 0 to
	  65535.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">set_alpha</code>() method sets the current
      opacity (and the "alpha" property) to the value specified by
      <em class="parameter"><code>alpha</code></em>.</p></div><div class="refsect2" title="gtk.ColorButton.get_alpha"><a name="method-gtkcolorbutton--get-alpha"></a><h3>gtk.ColorButton.get_alpha</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_alpha</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the opacity in the range 0 to
	  65535.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">get_alpha</code>() method returns the
      value of the "alpha" property that contains the opacity setting.</p></div><div class="refsect2" title="gtk.ColorButton.set_use_alpha"><a name="method-gtkcolorbutton--set-use-alpha"></a><h3>gtk.ColorButton.set_use_alpha</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_use_alpha</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_alpha</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>use_alpha</code></strong> :</span></p></td><td>if <code class="literal">True</code>, the color button
	  should use the alpha channel.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">set_use_alpha</code>() method sets the
      "use-alpha" property to the value of
      <em class="parameter"><code>use_alpha</code></em>. If <em class="parameter"><code>use_alpha</code></em>
      is <code class="literal">True</code>, 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" title="gtk.ColorButton.get_use_alpha"><a name="method-gtkcolorbutton--get-use-alpha"></a><h3>gtk.ColorButton.get_use_alpha</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_use_alpha</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the color sample
	  should use the alpha channel</td></tr></tbody></table><div class="note" title="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 <code class="methodname">get_use_alpha</code>() method returns the
      value of the "use-alpha" property. If <code class="literal">True</code> the
      color selection dialog should use the alpha channel.</p></div><div class="refsect2" title="gtk.ColorButton.set_title"><a name="method-gtkcolorbutton--set-title"></a><h3>gtk.ColorButton.set_title</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_title</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>title</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>title</code></strong> :</span></p></td><td>a string containing the new <a class="link" href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><code class="classname">gtk.ColorSelectionDialog</code></a>
	  title.</td></tr></tbody></table><div class="note" title="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 <code class="methodname">set_title</code>() method sets the title
      for the color selection dialog to the string contained in
      <em class="parameter"><code>title</code></em>. The "title" property is also set. </p></div><div class="refsect2" title="gtk.ColorButton.get_title"><a name="method-gtkcolorbutton--get-title"></a><h3>gtk.ColorButton.get_title</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_title</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the title of the <a class="link" href="class-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><code class="classname">gtk.ColorSelectionDialog</code></a></td></tr></tbody></table><div class="note" title="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 <code class="methodname">get_title</code>() method returns the
      value of the "title" property that contains the title of the color
      selection dialog.</p></div></div><div class="refsect1" title="Signals"><a name="id3647243"></a><h2>Signals</h2><div class="refsect2" title='The "color-set" gtk.ColorButton Signal'><a name="signal-gtkcolorbutton--color-set"></a><h3>The "color-set" gtk.ColorButton Signal</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>colorbutton</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>colorbutton</code></em> :</span></p></td><td>the colorbutton that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><div class="note" title="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 class="link" href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-color" title="gtk.ColorButton.get_color"><code class="methodname">get_color</code>()</a>
      and the <a class="link" href="class-gtkcolorbutton.html#method-gtkcolorbutton--get-alpha" title="gtk.ColorButton.get_alpha"><code class="methodname">get_alpha</code>()</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>