1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Button</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" 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-gtkbox.html" title="gtk.Box"><link rel="next" href="class-gtkbuilder.html" title="gtk.Builder"></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.Button</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkbox.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkbuilder.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkbutton"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Button</h2><p>gtk.Button — A pushbutton widget that issues a signal when
2
clicked.</p></div><div class="refsect1" lang="en"><a name="id3352448"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Button</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a></span></span>):
3
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtkbutton.html#constructor-gtkbutton" title="Constructor">gtk.Button</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>label</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</code></strong></span><span class="initializer">=True</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--pressed" title="gtk.Button.pressed">pressed</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--released" title="gtk.Button.released">released</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--clicked" title="gtk.Button.clicked">clicked</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--enter" title="gtk.Button.enter">enter</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--leave" title="gtk.Button.leave">leave</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-relief" title="gtk.Button.set_relief">set_relief</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>newstyle</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-relief" title="gtk.Button.get_relief">get_relief</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-label" title="gtk.Button.set_label">set_label</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>label</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-label" title="gtk.Button.get_label">get_label</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-use-underline" title="gtk.Button.set_use_underline">set_use_underline</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-use-underline" title="gtk.Button.get_use_underline">get_use_underline</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-use-stock" title="gtk.Button.set_use_stock">set_use_stock</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_stock</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-use-stock" title="gtk.Button.get_use_stock">get_use_stock</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-focus-on-click" title="gtk.Button.set_focus_on_click">set_focus_on_click</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>focus_on_click</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-focus-on-click" title="gtk.Button.get_focus_on_click">get_focus_on_click</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-alignment" title="gtk.Button.set_alignment">set_alignment</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>xalign</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>yalign</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-alignment" title="gtk.Button.get_alignment">get_alignment</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-image" title="gtk.Button.set_image">set_image</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-image" title="gtk.Button.get_image">get_image</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3350927"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Button</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.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="prev" href="class-gtkbox.html" title="gtk.Box"><link rel="next" href="class-gtkbuilder.html" title="gtk.Builder"></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.Button</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkbox.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkbuilder.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.Button"><a name="class-gtkbutton"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Button</h2><p>gtk.Button — A pushbutton widget that issues a signal when
2
clicked.</p></div><div class="refsect1" title="Synopsis"><a name="id3661156"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Button</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a></span></span>):
3
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtkbutton.html#constructor-gtkbutton" title="Constructor">gtk.Button</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>label</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</code></strong></span><span class="initializer">=True</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--pressed" title="gtk.Button.pressed">pressed</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--released" title="gtk.Button.released">released</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--clicked" title="gtk.Button.clicked">clicked</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--enter" title="gtk.Button.enter">enter</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--leave" title="gtk.Button.leave">leave</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-relief" title="gtk.Button.set_relief">set_relief</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>newstyle</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-relief" title="gtk.Button.get_relief">get_relief</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-label" title="gtk.Button.set_label">set_label</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>label</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-label" title="gtk.Button.get_label">get_label</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-use-underline" title="gtk.Button.set_use_underline">set_use_underline</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-use-underline" title="gtk.Button.get_use_underline">get_use_underline</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-use-stock" title="gtk.Button.set_use_stock">set_use_stock</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_stock</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-use-stock" title="gtk.Button.get_use_stock">get_use_stock</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-focus-on-click" title="gtk.Button.set_focus_on_click">set_focus_on_click</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>focus_on_click</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-focus-on-click" title="gtk.Button.get_focus_on_click">get_focus_on_click</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-alignment" title="gtk.Button.set_alignment">set_alignment</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>xalign</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>yalign</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-alignment" title="gtk.Button.get_alignment">get_alignment</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--set-image" title="gtk.Button.set_image">set_image</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkbutton.html#method-gtkbutton--get-image" title="gtk.Button.get_image">get_image</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3672182"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
4
4
+-- <a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
5
5
+-- <a class="link" href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
6
6
+-- <a class="link" href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
7
7
+-- <a class="link" href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
8
8
+-- <a class="link" href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a>
9
</pre></div><div class="refsect1" lang="en"><a name="id3290516"></a><h2>Implemented Interfaces</h2><p>
9
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3520855"></a><h2>Implemented Interfaces</h2><p>
10
10
<a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a>
12
12
<a class="link" href="class-gtkbuildable.html" title="gtk.Buildable"><code class="classname">gtk.Buildable</code></a>
13
</p></div><div class="refsect1" lang="en"><a name="properties-gtkbutton"></a><h2>gtk.Button 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><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">"focus-on-click"</td><td valign="top">Read/Write</td><td valign="top">If <code class="literal">True</code> the button grabs focus when
13
</p></div><div class="refsect1" title="gtk.Button Properties"><a name="properties-gtkbutton"></a><h2>gtk.Button 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><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="3.5in"></colgroup><tbody><tr valign="top"><td valign="top">"focus-on-click"</td><td valign="top">Read/Write</td><td valign="top">If <code class="literal">True</code> the button grabs focus when
14
14
it is clicked with the mouse. Default value:
15
15
<code class="literal">True</code>. This property is available in GTK+ 2.4 and
16
16
above.</td></tr><tr valign="top"><td valign="top">"image"</td><td valign="top">Read/Write</td><td valign="top">The child widget to appear next to the button text. Default
48
48
"child-displacement-y" properties should also affect the focus
49
49
rectangle. Default value: <code class="literal">False</code>. This property
50
50
is available in GTK+ 2.6 and above.</td></tr><tr valign="top"><td valign="top">"inner-border"</td><td valign="top">Read</td><td valign="top">The border between the button edges and child as a <a class="link" href="class-gtkborder.html" title="gtk.Border"><code class="classname">gtk.Border</code></a>.
51
This property is available in GTK+ 2.10 and above.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="signal-prototypes-gtkbutton"></a><h2>gtk.Button 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><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-gtkbutton.html#signal-gtkbutton--activate" title='The "activate" gtk.Button Signal'>activate</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--clicked" title='The "clicked" gtk.Button Signal'>clicked</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--enter" title='The "enter" gtk.Button Signal'>enter</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--leave" title='The "leave" gtk.Button Signal'>leave</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--pressed" title='The "pressed" gtk.Button Signal'>pressed</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--released" title='The "released" gtk.Button Signal'>released</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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" lang="en"><a name="id3263172"></a><h2>Description</h2><p>The <a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a> widget is
51
This property is available in GTK+ 2.10 and above.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Button Signal Prototypes"><a name="signal-prototypes-gtkbutton"></a><h2>gtk.Button 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><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-gtkbutton.html#signal-gtkbutton--activate" title='The "activate" gtk.Button Signal'>activate</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--clicked" title='The "clicked" gtk.Button Signal'>clicked</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--enter" title='The "enter" gtk.Button Signal'>enter</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--leave" title='The "leave" gtk.Button Signal'>leave</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--pressed" title='The "pressed" gtk.Button Signal'>pressed</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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><tr><td><p><span class="term">"<a class="link" href="class-gtkbutton.html#signal-gtkbutton--released" title='The "released" gtk.Button Signal'>released</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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="id3592805"></a><h2>Description</h2><p>The <a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a> widget is
52
52
usually displayed as a pushbutton with a text label (<a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a>) though it
53
53
can contain any valid widget. The <a class="link" href="class-gtkbutton.html" title="gtk.Button"><code class="classname">gtk.Button</code></a> is
54
54
generally used to attach a callback function or method that is called when
55
the button is clicked. Buttons generate signals that indicate:</p><div class="itemizedlist"><ul type="disc"><li>"clicked" - the user pressed and released a mouse button
56
over the button</li><li>"pressed" - the user pressed a mouse button over the
57
button</li><li>"released" - the user released a mouse button over the
58
button</li><li>"enter" - the pointer entered the button</li><li>"leave" - the pointer left the button</li></ul></div><p>The "clicked" signal is usually the only signal that an
55
the button is clicked. Buttons generate signals that indicate:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">"clicked" - the user pressed and released a mouse button
56
over the button</li><li class="listitem">"pressed" - the user pressed a mouse button over the
57
button</li><li class="listitem">"released" - the user released a mouse button over the
58
button</li><li class="listitem">"enter" - the pointer entered the button</li><li class="listitem">"leave" - the pointer left the button</li></ul></div><p>The "clicked" signal is usually the only signal that an
59
59
application needs to handle.</p><p>If a label is being used by the button its text (the "label"
60
60
property) is retrieved using the <a class="link" href="class-gtkbutton.html#method-gtkbutton--get-label" title="gtk.Button.get_label"><code class="methodname">get_label</code>()</a>
61
61
method. The label text is changed using the <a class="link" href="class-gtkbutton.html#method-gtkbutton--set-label" title="gtk.Button.set_label"><code class="methodname">set_label</code>()</a>
92
92
used as the keyboard accelerator for the button when pressed simultaneously
93
93
with the <span class="keycap"><strong>Alt</strong></span> key. In PyGTK 2.4 and above the
94
94
"use-underline" property can be set by using the optional
95
<em class="parameter"><code>use_underline</code></em> parameter.</p></div><div class="refsect1" lang="en"><a name="id3306826"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkbutton--pressed"></a><h3>gtk.Button.pressed</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">pressed</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">pressed</code>() method emits the
96
"pressed" signal to the button.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--released"></a><h3>gtk.Button.released</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">released</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">released</code>() method emits the
97
"released" signal to the button.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--clicked"></a><h3>gtk.Button.clicked</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">clicked</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">clicked</code>() method emits the
98
"clicked" signal to the button.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--enter"></a><h3>gtk.Button.enter</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">enter</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">enter</code>() method emits the "enter"
99
signal to the button.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--leave"></a><h3>gtk.Button.leave</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">leave</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">leave</code>() method emits the "leave"
100
signal to the button.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--set-relief"></a><h3>gtk.Button.set_relief</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_relief</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>newstyle</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"><strong class="parameter"><code>newstyle</code></strong> :</span></p></td><td>one of <code class="literal">gtk.RELIEF_NONE</code>,
95
<em class="parameter"><code>use_underline</code></em> parameter.</p></div><div class="refsect1" title="Methods"><a name="id3555488"></a><h2>Methods</h2><div class="refsect2" title="gtk.Button.pressed"><a name="method-gtkbutton--pressed"></a><h3>gtk.Button.pressed</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">pressed</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">pressed</code>() method emits the
96
"pressed" signal to the button.</p></div><div class="refsect2" title="gtk.Button.released"><a name="method-gtkbutton--released"></a><h3>gtk.Button.released</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">released</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">released</code>() method emits the
97
"released" signal to the button.</p></div><div class="refsect2" title="gtk.Button.clicked"><a name="method-gtkbutton--clicked"></a><h3>gtk.Button.clicked</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">clicked</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">clicked</code>() method emits the
98
"clicked" signal to the button.</p></div><div class="refsect2" title="gtk.Button.enter"><a name="method-gtkbutton--enter"></a><h3>gtk.Button.enter</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">enter</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">enter</code>() method emits the "enter"
99
signal to the button.</p></div><div class="refsect2" title="gtk.Button.leave"><a name="method-gtkbutton--leave"></a><h3>gtk.Button.leave</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">leave</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">leave</code>() method emits the "leave"
100
signal to the button.</p></div><div class="refsect2" title="gtk.Button.set_relief"><a name="method-gtkbutton--set-relief"></a><h3>gtk.Button.set_relief</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_relief</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>newstyle</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"><strong class="parameter"><code>newstyle</code></strong> :</span></p></td><td>one of <code class="literal">gtk.RELIEF_NONE</code>,
101
101
<code class="literal">gtk.RELIEF_NORMAL</code> or
102
102
<code class="literal">gtk.RELIEF_HALF</code></td></tr></tbody></table><p>The <code class="methodname">set_relief</code>() method sets the relief
103
103
style of the edges of the button. Three styles exist,
104
104
<code class="literal">gtk.RELIEF_NORMAL</code>, <code class="literal">gtk.RELIEF_HALF</code>,
105
105
<code class="literal">gtk.RELIEF_NONE</code>. The default style is, as one can guess,
106
<code class="literal">gtk.RELIEF_NORMAL</code>.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--get-relief"></a><h3>gtk.Button.get_relief</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_relief</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 relief style</td></tr></tbody></table><p>The <code class="methodname">get_relief</code>() method retrieves the
107
current relief style (the "relief" property) set for the button.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--set-label"></a><h3>gtk.Button.set_label</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_label</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</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"><strong class="parameter"><code>label</code></strong> :</span></p></td><td>a string to be set as the text in the button
106
<code class="literal">gtk.RELIEF_NORMAL</code>.</p></div><div class="refsect2" title="gtk.Button.get_relief"><a name="method-gtkbutton--get-relief"></a><h3>gtk.Button.get_relief</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_relief</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 relief style</td></tr></tbody></table><p>The <code class="methodname">get_relief</code>() method retrieves the
107
current relief style (the "relief" property) set for the button.</p></div><div class="refsect2" title="gtk.Button.set_label"><a name="method-gtkbutton--set-label"></a><h3>gtk.Button.set_label</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_label</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>label</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"><strong class="parameter"><code>label</code></strong> :</span></p></td><td>a string to be set as the text in the button
108
108
label</td></tr></tbody></table><p>The <code class="methodname">set_label</code>() method sets the text of
109
109
the button label to <em class="parameter"><code>label</code></em> (also sets the "label"
110
110
property). This string is also used to select the stock item if the
111
111
"use_stock" property is <code class="literal">True</code> and the string references a
112
stock item. Any previously set labels will be cleared.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--get-label"></a><h3>gtk.Button.get_label</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_label</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 text of the label
112
stock item. Any previously set labels will be cleared.</p></div><div class="refsect2" title="gtk.Button.get_label"><a name="method-gtkbutton--get-label"></a><h3>gtk.Button.get_label</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_label</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 text of the label
113
113
widget.</td></tr></tbody></table><p>The <code class="methodname">get_label</code>() method retrieves the
114
114
text from the label of the button, as set by <a class="link" href="class-gtkbutton.html#method-gtkbutton--set-label" title="gtk.Button.set_label"><code class="methodname">set_label</code>()</a>
115
115
or by the <a class="link" href="class-gtkbutton.html#constructor-gtkbutton" title="Constructor"><code class="methodname">gtk.Button</code>()</a>
117
117
freed. If the label text has not been set the return value will be
118
118
<code class="literal">None</code>. This will be the case if you create an empty button
119
119
with <a class="link" href="class-gtkbutton.html#constructor-gtkbutton" title="Constructor"><code class="methodname">gtk.Button</code>()</a>
120
to use as a container.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--set-use-underline"></a><h3>gtk.Button.set_use_underline</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_underline</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</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"><em class="parameter"><code>use_underline</code></em> :</span></p></td><td><code class="literal">True</code> if underscores in the text
120
to use as a container.</p></div><div class="refsect2" title="gtk.Button.set_use_underline"><a name="method-gtkbutton--set-use-underline"></a><h3>gtk.Button.set_use_underline</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_underline</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_underline</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"><em class="parameter"><code>use_underline</code></em> :</span></p></td><td><code class="literal">True</code> if underscores in the text
121
121
indicate mnemonics</td></tr></tbody></table><p>The <code class="methodname">set_use_underline</code>() method sets the
122
122
"use_underline" property to the value of
123
123
<em class="parameter"><code>use_underline</code></em>. If
124
124
<em class="parameter"><code>use_underline</code></em> is <code class="literal">True</code>, an
125
125
underscore in the text of the button label indicates that the next character
126
126
should be underlined and used for the mnemonic accelerator key if it is also
127
the first underlined character.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--get-use-underline"></a><h3>gtk.Button.get_use_underline</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_use_underline</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 an underscore in the button
127
the first underlined character.</p></div><div class="refsect2" title="gtk.Button.get_use_underline"><a name="method-gtkbutton--get-use-underline"></a><h3>gtk.Button.get_use_underline</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_use_underline</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 an underscore in the button
128
128
label indicates the mnemonic accelerator keys.</td></tr></tbody></table><p>The <code class="methodname">get_use_underline</code>() method returns
129
129
whether the "use_underline" property is <code class="literal">True</code> meaning that
130
an underscore in the button label indicates a mnemonic. See <a class="link" href="class-gtkbutton.html#method-gtkbutton--set-use-underline" title="gtk.Button.set_use_underline"><code class="methodname">set_use_underline</code>()</a>.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--set-use-stock"></a><h3>gtk.Button.set_use_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_stock</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_stock</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"><em class="parameter"><code>use_stock</code></em> :</span></p></td><td>If <code class="literal">True</code> the button should use a
130
an underscore in the button label indicates a mnemonic. See <a class="link" href="class-gtkbutton.html#method-gtkbutton--set-use-underline" title="gtk.Button.set_use_underline"><code class="methodname">set_use_underline</code>()</a>.</p></div><div class="refsect2" title="gtk.Button.set_use_stock"><a name="method-gtkbutton--set-use-stock"></a><h3>gtk.Button.set_use_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_stock</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>use_stock</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"><em class="parameter"><code>use_stock</code></em> :</span></p></td><td>If <code class="literal">True</code> the button should use a
131
131
stock item</td></tr></tbody></table><p>The <code class="methodname">set_use_stock</code>() method sets the
132
132
"use_stock" property to the value of <em class="parameter"><code>use_stock</code></em>. If
133
133
<em class="parameter"><code>use_stock</code></em> is <code class="literal">True</code>, the label set
134
134
on the button is used as a stock id to select the stock item for the
135
button.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--get-use-stock"></a><h3>gtk.Button.get_use_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_use_stock</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 value of the "use_stock" property.</td></tr></tbody></table><p>The <code class="methodname">get_use_stock</code>() method returns the
135
button.</p></div><div class="refsect2" title="gtk.Button.get_use_stock"><a name="method-gtkbutton--get-use-stock"></a><h3>gtk.Button.get_use_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_use_stock</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 value of the "use_stock" property.</td></tr></tbody></table><p>The <code class="methodname">get_use_stock</code>() method returns the
136
136
value of the "use_stock" property. If <code class="literal">True</code> the button
137
137
label is used to select a stock item instead of being used directly as the
138
label text.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--set-focus-on-click"></a><h3>gtk.Button.set_focus_on_click</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_focus_on_click</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>focus_on_click</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"><em class="parameter"><code>focus_on_click</code></em> :</span></p></td><td>If <code class="literal">True</code> the button grabs focus when
139
clicked with the mouse.</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 <code class="methodname">set_focus_on_click</code>() method sets
138
label text.</p></div><div class="refsect2" title="gtk.Button.set_focus_on_click"><a name="method-gtkbutton--set-focus-on-click"></a><h3>gtk.Button.set_focus_on_click</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_focus_on_click</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>focus_on_click</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"><em class="parameter"><code>focus_on_click</code></em> :</span></p></td><td>If <code class="literal">True</code> the button grabs focus when
139
clicked with the mouse.</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_focus_on_click</code>() method sets
140
140
the "focus-on-click" property to the value of
141
141
<em class="parameter"><code>focus_on_click</code></em>. If
142
142
<em class="parameter"><code>focus_on_click</code></em> is <code class="literal">True</code>, the button
143
grabs focus when it is clicked by the mouse.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--get-focus-on-click"></a><h3>gtk.Button.get_focus_on_click</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_focus_on_click</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 value of the "focus-on-click" property.</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 <code class="methodname">get_focus_on_click</code>() method returns
143
grabs focus when it is clicked by the mouse.</p></div><div class="refsect2" title="gtk.Button.get_focus_on_click"><a name="method-gtkbutton--get-focus-on-click"></a><h3>gtk.Button.get_focus_on_click</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_focus_on_click</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 value of the "focus-on-click" property.</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_focus_on_click</code>() method returns
144
144
the value of the "focus-on-click" property. If <code class="literal">True</code> the
145
button grabs focus when it is clicked by the mouse .</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--set-alignment"></a><h3>gtk.Button.set_alignment</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_alignment</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>xalign</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>yalign</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"><em class="parameter"><code>xalign</code></em> :</span></p></td><td>the horizontal alignment of the child widget. The value
145
button grabs focus when it is clicked by the mouse .</p></div><div class="refsect2" title="gtk.Button.set_alignment"><a name="method-gtkbutton--set-alignment"></a><h3>gtk.Button.set_alignment</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_alignment</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>xalign</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>yalign</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"><em class="parameter"><code>xalign</code></em> :</span></p></td><td>the horizontal alignment of the child widget. The value
146
146
ranges from 0.0 to 1.0 and represents the fraction of freespace
147
147
to the left of the child widget.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>yalign</code></em> :</span></p></td><td>the vertical alignment of the child widget. The value
148
148
ranges from 0.0 to 1.0 and represents the fraction of freespace
149
above the child widget.</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 <code class="methodname">set_alignment</code>() method sets the
149
above the child widget.</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_alignment</code>() method sets the
150
150
"xalign" and "yalign" properties to the value of
151
151
<em class="parameter"><code>xalign</code></em> and <em class="parameter"><code>yalign</code></em>
152
respectively. This property has no effect unless the child is a <a class="link" href="class-gtkmisc.html" title="gtk.Misc"><code class="classname">gtk.Misc</code></a> or a <a class="link" href="class-gtkalignment.html" title="gtk.Alignment"><code class="classname">gtk.Alignment</code></a>.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--get-alignment"></a><h3>gtk.Button.get_alignment</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_alignment</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 2-tuple containing the values of the "xalign" and
153
"yalign" properties.</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 <code class="methodname">get_alignment</code>() method returns the
154
values of the "xalign" and "yalign" properties. See the <a class="link" href="class-gtkbutton.html#method-gtkbutton--set-alignment" title="gtk.Button.set_alignment"><code class="methodname">set_alignment</code>()</a> method for more information.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--set-image"></a><h3>gtk.Button.set_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_image</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image</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"><em class="parameter"><code>image</code></em> :</span></p></td><td>the widget to set as the image for the button.</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.6 and above.</p></div><p>The <code class="methodname">set_image</code>() method sets the "image"
152
respectively. This property has no effect unless the child is a <a class="link" href="class-gtkmisc.html" title="gtk.Misc"><code class="classname">gtk.Misc</code></a> or a <a class="link" href="class-gtkalignment.html" title="gtk.Alignment"><code class="classname">gtk.Alignment</code></a>.</p></div><div class="refsect2" title="gtk.Button.get_alignment"><a name="method-gtkbutton--get-alignment"></a><h3>gtk.Button.get_alignment</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_alignment</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 2-tuple containing the values of the "xalign" and
153
"yalign" properties.</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_alignment</code>() method returns the
154
values of the "xalign" and "yalign" properties. See the <a class="link" href="class-gtkbutton.html#method-gtkbutton--set-alignment" title="gtk.Button.set_alignment"><code class="methodname">set_alignment</code>()</a> method for more information.</p></div><div class="refsect2" title="gtk.Button.set_image"><a name="method-gtkbutton--set-image"></a><h3>gtk.Button.set_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_image</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image</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"><em class="parameter"><code>image</code></em> :</span></p></td><td>the widget to set as the image for the 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 method is available in PyGTK 2.6 and above.</p></div><p>The <code class="methodname">set_image</code>() method sets the "image"
155
155
property to the value of <em class="parameter"><code>image</code></em>. This property has no
156
156
effect unless the "gtk-button-images" property is
157
157
<code class="literal">True</code>. See the <a class="link" href="class-gtksettings.html" title="gtk.Settings"><code class="classname">gtk.Settings</code></a>
158
158
reference for more information. Note you do not have to call the <a class="link" href="class-gtkwidget.html#method-gtkwidget--show" title="gtk.Widget.show"><code class="methodname">gtk.Widget.show</code>()</a>
159
method for <em class="parameter"><code>image</code></em>.</p></div><div class="refsect2" lang="en"><a name="method-gtkbutton--get-image"></a><h3>gtk.Button.get_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_image</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 <a class="link" href="class-gtkwidget.html" title="gtk.Widget"><code class="classname">gtk.Widget</code></a> used as
160
the button image or <code class="literal">None</code> if there is no image.</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.6 and above.</p></div><p>The <code class="methodname">get_image</code>() method returns the
159
method for <em class="parameter"><code>image</code></em>.</p></div><div class="refsect2" title="gtk.Button.get_image"><a name="method-gtkbutton--get-image"></a><h3>gtk.Button.get_image</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_image</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 <a class="link" href="class-gtkwidget.html" title="gtk.Widget"><code class="classname">gtk.Widget</code></a> used as
160
the button image or <code class="literal">None</code> if there is no image.</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.6 and above.</p></div><p>The <code class="methodname">get_image</code>() method returns the
161
161
value of the "image" property. See the <a class="link" href="class-gtkbutton.html#method-gtkbutton--set-image" title="gtk.Button.set_image"><code class="methodname">set_image</code>()</a>
162
method for more information.</p></div></div><div class="refsect1" lang="en"><a name="id3355184"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gtkbutton--activate"></a><h3>The "activate" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the "activate"
162
method for more information.</p></div></div><div class="refsect1" title="Signals"><a name="id3654074"></a><h2>Signals</h2><div class="refsect2" title='The "activate" gtk.Button Signal'><a name="signal-gtkbutton--activate"></a><h3>The "activate" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the "activate"
163
163
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
164
164
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
165
165
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
166
166
any)</td></tr></tbody></table><p>The "activate" signal is emitted when the <a class="link" href="class-gtkwidget.html#method-gtkwidget--activate" title="gtk.Widget.activate"><code class="methodname">gtk.Widget.activate</code>()</a>
167
167
method is called. For a button it causes the "clicked" signal to be
168
emitted.</p></div><div class="refsect2" lang="en"><a name="signal-gtkbutton--clicked"></a><h3>The "clicked" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
168
emitted.</p></div><div class="refsect2" title='The "clicked" gtk.Button Signal'><a name="signal-gtkbutton--clicked"></a><h3>The "clicked" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
169
169
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
170
170
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
171
171
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
172
172
any)</td></tr></tbody></table><p>The "clicked" signal is emitted when the mouse button is pressed
173
173
and released while the pointer is over the button or when the button is triggered
174
with the keyboard.</p></div><div class="refsect2" lang="en"><a name="signal-gtkbutton--enter"></a><h3>The "enter" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
174
with the keyboard.</p></div><div class="refsect2" title='The "enter" gtk.Button Signal'><a name="signal-gtkbutton--enter"></a><h3>The "enter" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
175
175
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
176
176
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
177
177
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
178
178
any)</td></tr></tbody></table><p>The "enter" signal is emitted when the pointer enters the
179
button.</p></div><div class="refsect2" lang="en"><a name="signal-gtkbutton--leave"></a><h3>The "leave" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
179
button.</p></div><div class="refsect2" title='The "leave" gtk.Button Signal'><a name="signal-gtkbutton--leave"></a><h3>The "leave" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
180
180
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
181
181
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
182
182
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
183
183
any)</td></tr></tbody></table><p>The "leave" signal is emitted when the pointer leaves the
184
button.</p></div><div class="refsect2" lang="en"><a name="signal-gtkbutton--pressed"></a><h3>The "pressed" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
184
button.</p></div><div class="refsect2" title='The "pressed" gtk.Button Signal'><a name="signal-gtkbutton--pressed"></a><h3>The "pressed" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
185
185
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
186
186
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
187
187
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
188
188
any)</td></tr></tbody></table><p>The "pressed" signal is emitted when the mouse button is pressed
189
while the pointer is over the button.</p></div><div class="refsect2" lang="en"><a name="signal-gtkbutton--released"></a><h3>The "released" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
189
while the pointer is over the button.</p></div><div class="refsect2" title='The "released" gtk.Button Signal'><a name="signal-gtkbutton--released"></a><h3>The "released" gtk.Button Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>button</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>button</code></em> :</span></p></td><td>the button that received the
190
190
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
191
191
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
192
192
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if