/usr/share/gtk-doc/html/pygtk/class-gtkdialog.html is in python-gtk2-doc 2.24.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Dialog</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-gtkcurve.html" title="gtk.Curve"><link rel="next" href="class-gtkdrawingarea.html" title="gtk.DrawingArea"></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.Dialog</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkcurve.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkdrawingarea.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.Dialog"><a name="class-gtkdialog"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Dialog</h2><p>gtk.Dialog — popup windows for user information and action</p></div><div class="refsect1" title="Synopsis"><a name="id3667349"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Dialog</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkwindow.html" title="gtk.Window">gtk.Window</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor">gtk.Dialog</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>title</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>parent</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>flags</code></strong></span><span class="initializer">=0</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>buttons</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--add-action-widget" title="gtk.Dialog.add_action_widget">add_action_widget</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--add-button" title="gtk.Dialog.add_button">add_button</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>button_text</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--add-buttons" title="gtk.Dialog.add_buttons">add_buttons</a></span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--set-response-sensitive" title="gtk.Dialog.set_response_sensitive">set_response_sensitive</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--set-default-response" title="gtk.Dialog.set_default_response">set_default_response</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--set-has-separator" title="gtk.Dialog.set_has_separator">set_has_separator</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--get-has-separator" title="gtk.Dialog.get_has_separator">get_has_separator</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--response" title="gtk.Dialog.response">response</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--run" title="gtk.Dialog.run">run</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--set-alternative-button-order" title="gtk.Dialog.set_alternative_button_order">set_alternative_button_order</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>new_order</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--get-response-for-widget" title="gtk.Dialog.get_response_for_widget">get_response_for_widget</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--get-widget-for-response" title="gtk.Dialog.get_widget_for_response">get_widget_for_response</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--get-action-area" title="gtk.Dialog.get_action_area">get_action_area</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--get-content-area" title="gtk.Dialog.get_content_area">get_content_area</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><pre class="programlisting">
<span class="bold"><strong>Functions</strong></span>
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkdialog.html#function-gtk--alternative-dialog-button-order" title="gtk.alternative_dialog_button_order">gtk.alternative_dialog_button_order</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>screen</code></strong></span><span class="initializer">=None</span></span>)</code></pre></div><div class="refsect1" title="Ancestry"><a name="id3667894"></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-gtkwindow.html" title="gtk.Window">gtk.Window</a>
+-- <a class="link" href="class-gtkdialog.html" title="gtk.Dialog">gtk.Dialog</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3667951"></a><h2>Implemented Interfaces</h2><p>
<a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</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.Dialog Properties"><a name="properties-gtkdialog"></a><h2>gtk.Dialog 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-gtkwindow.html#properties-gtkwindow" title="gtk.Window Properties">gtk.Window 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">"has-separator"</td><td valign="top">Read/Write</td><td valign="top">If <code class="literal">True</code>, the dialog has a separator bar above its
buttons. This property has been deprecated since GTK+ 2.22 and should not
be used in newly-written code.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Dialog Style Properties"><a name="style-properties-gtkdialog"></a><h2>gtk.Dialog 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><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">"action-area-border"</td><td valign="top">Read</td><td valign="top">The width of the vborder around the button area in pixels.</td></tr><tr valign="top"><td valign="top">"button-spacing"</td><td valign="top">Read</td><td valign="top">The spacing between buttons in pixels.</td></tr><tr valign="top"><td valign="top">"content-area-spacing"</td><td valign="top">Read</td><td valign="top">The default spacing used between elements of the content area of the dialog, as returned by
<code class="methodname"><a class="link" href="class-gtkdialog.html#method-gtkdialog--get-content-area" title="gtk.Dialog.get_content_area">gtk.Dialog.get_content_area</a></code>(),
unless <code class="methodname"><a class="link" href="class-gtkbox.html#method-gtkbox--set-spacing" title="gtk.Box.set_spacing">gtk.Box.set_spacing</a></code>()
was called on that widget directly. Allowed values: >= 0. Default value: 0. This property is available in GTK+ 2.16 and above.</td></tr><tr valign="top"><td valign="top">"content-area-border"</td><td valign="top">Read</td><td valign="top">The width of the border around the main dialog area in pixels.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="Attributes"><a name="id3668250"></a><h2>Attributes</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table cellpadding="5" width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="3.5in"></colgroup><tbody><tr valign="top"><td valign="top">"vbox"</td><td valign="top">Read</td><td valign="top">A <a class="link" href="class-gtkvbox.html" title="gtk.VBox"><code class="classname">gtk.VBox</code></a> that is the main container of the dialog - all the other widgets are packed in it.</td></tr><tr valign="top"><td valign="top">"action_area"</td><td valign="top">Read</td><td valign="top">A <a class="link" href="class-gtkhbox.html" title="gtk.HBox"><code class="classname">gtk.HBox</code></a> that contains the buttons of the dialog.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Dialog Signal Prototypes"><a name="signal-prototypes-gtkdialog"></a><h2>gtk.Dialog 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-gtkwindow.html#signal-prototypes-gtkwindow" title="gtk.Window Signal Prototypes">gtk.Window 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-gtkdialog.html#signal-gtkdialog--close" title='The "close" gtk.Dialog Signal'>close</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>dialog</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-gtkdialog.html#signal-gtkdialog--response" title='The "response" gtk.Dialog Signal'>response</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>dialog</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>response_id</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="id3668546"></a><h2>Description</h2><p>Dialog boxes are a convenient way to prompt the user for a small
amount of input, e.g. to display a message, ask a question, or anything
else that does not require extensive effort on the user's part. Dialogs
are organized as a window split vertically. The top section is a <a class="link" href="class-gtkvbox.html" title="gtk.VBox"><code class="classname">gtk.VBox</code></a>, and is
where widgets such as a <a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> or a
<a class="link" href="class-gtkentry.html" title="gtk.Entry"><code class="classname">gtk.Entry</code></a>
should be packed. The bottom area is known as the action_area which is
generally used for packing buttons into the dialog which may perform
functions such as cancel, ok, or apply. The two areas are separated by a
<a class="link" href="class-gtkhseparator.html" title="gtk.HSeparator"><code class="classname">gtk.HSeparator</code></a>.</p><p>The <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> boxes
are created with a call to <a class="link" href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor"><code class="methodname">gtk.Dialog</code></a>()
that sets the dialog title, some convenient flags, and adds simple
buttons. In a newly created dialog, the two primary areas of the window
can be accessed as the vbox and action_area attributes, as can be seen
from the example, below.</p><pre class="programlisting">
import gtk
label = gtk.Label("Nice label")
dialog = gtk.Dialog("My dialog",
None,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
dialog.vbox.pack_start(label)
label.show()
checkbox = gtk.CheckButton("Useless checkbox")
dialog.action_area.pack_end(checkbox)
checkbox.show()
response = dialog.run()
dialog.destroy()
</pre><p>A modal dialog (that is, one which freezes the
rest of the application from user input), can be created by passing the
<code class="literal">gtk.DIALOG_MODAL</code> flag to the <a class="link" href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor"><code class="methodname">gtk.Dialog</code>()</a>
constructor or by calling <a class="link" href="class-gtkwindow.html#method-gtkwindow--set-modal" title="gtk.Window.set_modal"><code class="methodname">set_modal</code>()</a>
on the dialog.</p><p>If you add buttons to <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> using
<a class="link" href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor"><code class="methodname">gtk.Dialog</code>()</a>,
<a class="link" href="class-gtkdialog.html#method-gtkdialog--add-button" title="gtk.Dialog.add_button"><code class="methodname">add_button</code>()</a>,
or <a class="link" href="class-gtkdialog.html#method-gtkdialog--add-action-widget" title="gtk.Dialog.add_action_widget"><code class="methodname">add_action_widget</code>()</a>,
clicking the button will emit a signal called "response" with a response
ID that you specified. PyGTK will never assign a meaning to positive
response IDs; these are entirely user-defined. But for convenience, you
can use the pre-defined <a class="xref" href="gtk-constants.html#gtk-response-type-constants" title="GTK Response Type Constants">GTK Response Type Constants</a> (these all have
values less than zero).</p><p>If a dialog receives a delete event, the "response" signal will be
emitted with a response ID of
<code class="literal">gtk.RESPONSE_DELETE_EVENT</code>.</p><p>If you want to block waiting for a dialog to return before
returning control flow to your code, you can call <a class="link" href="class-gtkdialog.html#method-gtkdialog--run" title="gtk.Dialog.run"><code class="methodname">run</code>()</a>. This
function enters a recursive main loop and waits for the user to respond
to the dialog, returning the response ID corresponding to the button the
user clicked.</p></div><div class="refsect1" title="Constructor"><a name="constructor-gtkdialog"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.Dialog</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>title</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>parent</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>flags</code></strong></span><span class="initializer">=0</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>buttons</code></strong></span><span class="initializer">=None</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>The title of the dialog, or <code class="literal">None</code></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>parent</code></strong> :</span></p></td><td>The transient parent of the dialog, or <code class="literal">None</code></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>flags</code></strong> :</span></p></td><td>flags that control the operation of the dialog</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>buttons</code></strong> :</span></p></td><td>a tuple containing button text/response id pairs or <code class="literal">None</code></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a></td></tr></tbody></table><p>Creates a new <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> with the
title text specified by <em class="parameter"><code>title</code></em> (or
<code class="literal">None</code> for the default title; see <a class="link" href="class-gtkwindow.html#method-gtkwindow--set-title" title="gtk.Window.set_title"><code class="methodname">gtk.Window.set_title</code>()</a>)
and transient parent window specified by <em class="parameter"><code>parent</code></em> (or
<code class="literal">None</code> for none; see <a class="link" href="class-gtkwindow.html#method-gtkwindow--set-transient-for" title="gtk.Window.set_transient_for"><code class="methodname">gtk.Window.set_transient_for</code>()</a>).
The <em class="parameter"><code>flags</code></em> argument can be used to make the dialog
modal (<code class="literal">gtk.DIALOG_MODAL</code>) and/or to have it destroyed
along with its transient parent
(<code class="literal">gtk.DIALOG_DESTROY_WITH_PARENT</code>) and/or remove the
separator (<code class="literal">gtk.DIALOG_NO_SEPARATOR</code>) (see the <a class="xref" href="gtk-constants.html#gtk-dialog-flag-constants" title="GTK Dialog Flag Constants">GTK Dialog Flag Constants</a> for more
information). After <em class="parameter"><code>flags</code></em>, a tuple of button
text/response ID pairs should be listed, or <code class="literal">None</code> (the
default value) if no buttons are needed. The button text can be either a
stock ID such as <code class="literal">gtk.STOCK_OK</code>, or some arbitrary text. A
response ID can be any positive number, or one of the pre-defined <a class="xref" href="gtk-constants.html#gtk-response-type-constants" title="GTK Response Type Constants">GTK Response Type Constants</a>.</p><p>If the user clicks one of these dialog buttons, the <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> will emit
the "response" signal with the corresponding response ID. If a <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> receives
the "delete_event" signal, it will emit "response" with a response ID of
<code class="literal">gtk.RESPONSE_DELETE_EVENT</code>. However, destroying a dialog
does not emit the "response" signal; so be careful relying on "response"
when using the <code class="literal">gtk.DIALOG_DESTROY_WITH_PARENT</code> flag.
Buttons are added from left to right, so the first button in the list will
be the leftmost button in the dialog.</p><p>Here's a simple example:</p><pre class="programlisting">
dialog = gtk.Dialog("My dialog",
main_app_window,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
</pre></div><div class="refsect1" title="Methods"><a name="id3669120"></a><h2>Methods</h2><div class="refsect2" title="gtk.Dialog.add_action_widget"><a name="method-gtkdialog--add-action-widget"></a><h3>gtk.Dialog.add_action_widget</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">add_action_widget</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</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>child</code></strong> :</span></p></td><td>an activatable widget</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>response_id</code></strong> :</span></p></td><td>a response ID</td></tr></tbody></table><p>The <code class="methodname">add_action_widget</code>() method adds an
activatable widget to the action area of a <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a>,
connecting a signal handler that will emit the "response" signal on the
dialog when the widget is activated. The widget is appended to the end of
the dialog's action area. If you want to add a non-activatable widget,
simply pack it into the <code class="literal">action_area</code>.</p></div><div class="refsect2" title="gtk.Dialog.add_button"><a name="method-gtkdialog--add-button"></a><h3>gtk.Dialog.add_button</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">add_button</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>button_text</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</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>button_text</code></strong> :</span></p></td><td>the text of the button, or a stock ID</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>response_id</code></strong> :</span></p></td><td>the response ID for the button</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the button widget that was added</td></tr></tbody></table><p>The <code class="methodname">add_button</code>() method adds a button
with the text specified by <em class="parameter"><code>button_text</code></em> (or a stock
button, if <em class="parameter"><code>button_text</code></em> is a stock ID) and sets things
up so that clicking the button will emit the "response" signal with the
specified <em class="parameter"><code>response_id</code></em>. The button is appended to the
end of the dialog's action area. The button widget is returned, but usually
you don't need it.</p></div><div class="refsect2" title="gtk.Dialog.add_buttons"><a name="method-gtkdialog--add-buttons"></a><h3>gtk.Dialog.add_buttons</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">add_buttons</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>...</code></em> :</span></p></td><td>one or more pairs of button specifiers: button text (or stock ID) and a response id</td></tr></tbody></table><p>The <code class="methodname">add_buttons</code>() method adds several
buttons to the <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> using the
button data passed as arguments to the method. This method is the same as
calling the <a class="link" href="class-gtkdialog.html#method-gtkdialog--add-button" title="gtk.Dialog.add_button"><code class="methodname">gtk.Dialog.add_button</code>()</a>
repeatedly. The button data pairs - button text (or stock ID) and a response
ID integer are passed individually. For example:</p><pre class="programlisting">
dialog.add_buttons(gtk.STOCK_OPEN, 42, "Close", gtk.RESPONSE_CLOSE)
</pre><p>will add "Open" and "Close" buttons to <em class="parameter"><code>dialog</code></em>.</p></div><div class="refsect2" title="gtk.Dialog.set_response_sensitive"><a name="method-gtkdialog--set-response-sensitive"></a><h3>gtk.Dialog.set_response_sensitive</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_response_sensitive</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</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>response_id</code></strong> :</span></p></td><td>a response ID</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>setting</code></strong> :</span></p></td><td>the new value for sensitive</td></tr></tbody></table><p>The <code class="methodname">set_response_sensitive</code>() method
calls the <a class="link" href="class-gtkwidget.html#method-gtkwidget--set-sensitive" title="gtk.Widget.set_sensitive"><code class="methodname">gtk.Window.set_sensitive</code>()</a>
method with the specified <em class="parameter"><code>response_id</code></em> for each widget
in the dialog's action area. This method is a convenience function to
sensitize/desensitize all dialog buttons at once.</p></div><div class="refsect2" title="gtk.Dialog.set_default_response"><a name="method-gtkdialog--set-default-response"></a><h3>gtk.Dialog.set_default_response</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_default_response</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</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>response_id</code></strong> :</span></p></td><td>a response ID</td></tr></tbody></table><p>The <code class="methodname">set_default_response</code>() method sets
the last widget in the dialog's action area with the specified
<em class="parameter"><code>response_id</code></em> as the default widget for the dialog.
Pressing <span class="keycap"><strong>Enter</strong></span> normally activates the default
widget.</p></div><div class="refsect2" title="gtk.Dialog.set_has_separator"><a name="method-gtkdialog--set-has-separator"></a><h3>gtk.Dialog.set_has_separator</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_has_separator</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>setting</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>setting</code></strong> :</span></p></td><td>If <code class="literal">True</code> use a separator</td></tr></tbody></table><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
This method is deprecated in PyGTK 2.22 and above and should not be
used in newly-written code.
</p></div><p>The <code class="methodname">set_has_separator</code>() method sets the
"has-separator" property to the value of <em class="parameter"><code>setting</code></em>. If
<em class="parameter"><code>setting</code></em> is <code class="literal">True</code> (the default
value) the dialog has a separator above the buttons.</p></div><div class="refsect2" title="gtk.Dialog.get_has_separator"><a name="method-gtkdialog--get-has-separator"></a><h3>gtk.Dialog.get_has_separator</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_has_separator</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 "has-separator" property</td></tr></tbody></table><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
This method is deprecated in PyGTK 2.22 and above and should not be
used in newly-written code.
</p></div><p>The <code class="methodname">get_has_separator</code>() method returns
the value of the "has-separator" property.</p></div><div class="refsect2" title="gtk.Dialog.response"><a name="method-gtkdialog--response"></a><h3>gtk.Dialog.response</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">response</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</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>response_id</code></strong> :</span></p></td><td>response ID</td></tr></tbody></table><p>The <code class="methodname">response</code>() method emits the
"response" signal with the value specified in
<em class="parameter"><code>response_id</code></em>. This method is used to indicate that the
user has responded to the dialog in some way; typically either you or <a class="link" href="class-gtkdialog.html#method-gtkdialog--run" title="gtk.Dialog.run"><code class="function">gtk.Dialog.run()</code></a>
will be monitoring the "response" signal and take appropriate action.</p></div><div class="refsect2" title="gtk.Dialog.run"><a name="method-gtkdialog--run"></a><h3>gtk.Dialog.run</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">run</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 response ID</td></tr></tbody></table><p>The <code class="methodname">run</code>() method blocks in a recursive
main loop until the dialog either emits the "response" signal, or is
destroyed. If the dialog is destroyed, the <code class="methodname">run</code>()
method returns <code class="literal">gtk.RESPONSE_NONE</code>; otherwise, it returns
the response ID from the "response" signal emission. Before entering the
recursive main loop, the <code class="methodname">run</code>() method calls the
<a class="link" href="class-gtkwidget.html#method-gtkwidget--show" title="gtk.Widget.show"><code class="methodname">gtk.Widget.show</code>()</a>
on the dialog for you. Note that you still need to show any children of the
dialog yourself.</p><p>During the <code class="methodname">run</code>() method, the default
behavior of "delete_event" is disabled; if the dialog receives a
"delete_event", it will not be destroyed as windows usually are, and the
<code class="methodname">run</code>() method will return
<code class="literal">gtk.RESPONSE_DELETE_EVENT</code>. Also, during the
<code class="methodname">run</code>() method the dialog will be modal. You can
force the <code class="methodname">run</code>() method to return at any time by
calling <a class="link" href="class-gtkdialog.html#method-gtkdialog--response" title="gtk.Dialog.response"><code class="methodname">response</code>()</a>
to emit the "response" signal. Destroying the dialog during the
<code class="methodname">run</code>() method is a very bad idea, because your
post-run code won't know whether the dialog was destroyed or not.</p><p>After the <code class="methodname">run</code>() method returns, you are
responsible for hiding or destroying the dialog as needed.</p></div><div class="refsect2" title="gtk.Dialog.set_alternative_button_order"><a name="method-gtkdialog--set-alternative-button-order"></a><h3>gtk.Dialog.set_alternative_button_order</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_alternative_button_order</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>new_order</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>new_order</code></strong> :</span></p></td><td>a sequence containing response id integer values</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_alternative_button_order</code>()
method sets an alternative button order for the dialog based on the sequence
of response ids specified by <em class="parameter"><code>new_order</code></em>. If the
"gtk-alternative-button-order" property of the <a class="link" href="class-gtksettings.html" title="gtk.Settings"><code class="classname">gtk.Settings</code></a>
object is set to <code class="literal">True</code>, the dialog buttons are reordered
according to the order of the response ids passed to this method.</p><p>By default, GTK+ dialogs use the button order advocated by the
Gnome Human Interface Guidelines with the affirmative button at the far
right, and the cancel button left of it. But the builtin GTK+ dialogs and
<a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>s
do provide an alternative button order, which is more suitable on some
platforms, e.g. Windows.</p><p>Use this method after adding all the buttons to your dialog,
as the following example shows:</p><pre class="programlisting">
settings = gtk.settings_get_default()
settings.set_property('gtk-alternative-button-order', True)
dialog = gtk.Dialog()
cancel_button = dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
ok_button = dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
ok_button.grab_default()
help_button = dialog.add_button(gtk.STOCK_HELP, gtk.RESPONSE_HELP)
dialog.set_alternative_button_order([gtk.RESPONSE_OK, gtk.RESPONSE_CANCEL,
gtk.RESPONSE_HELP])
</pre></div><div class="refsect2" title="gtk.Dialog.get_response_for_widget"><a name="method-gtkdialog--get-response-for-widget"></a><h3>gtk.Dialog.get_response_for_widget</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_response_for_widget</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</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>widget</code></strong> :</span></p></td><td>a widget in the action area of the dialog</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the response id of <em class="parameter"><code>widget</code></em>, or gtk.RESPONSE_NONE if the widget doesn't have a response id set.</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.8 and above.</p></div><p>The <code class="methodname">get_response_for_widget</code>() method
returns the response id of the widget specified by
<em class="parameter"><code>widget</code></em> in the action area of the dialog.</p></div><div class="refsect2" title="gtk.Dialog.get_widget_for_response"><a name="method-gtkdialog--get-widget-for-response"></a><h3>gtk.Dialog.get_widget_for_response</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_widget_for_response</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>response_id</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>response_id</code></strong> :</span></p></td><td>the response ID used by the dialog widget </td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the widget button that uses the given response_id, or <code class="literal">None</code>.</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.22 and above.</p></div><p>The <code class="methodname">get_widget_for_response</code>() method returns the widget button
that uses the given response ID in the action area of a dialog, or <code class="literal">None</code>.</p></div><div class="refsect2" title="gtk.Dialog.get_action_area"><a name="method-gtkdialog--get-action-area"></a><h3>gtk.Dialog.get_action_area</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_action_area</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 action area.</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.14 and above.</p></div><p>The <code class="methodname">get_action_area</code>() method
returns the action area of dialog.</p></div><div class="refsect2" title="gtk.Dialog.get_content_area"><a name="method-gtkdialog--get-content-area"></a><h3>gtk.Dialog.get_content_area</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_content_area</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 content area <a class="link" href="class-gdkscreen.html" title="gtk.gdk.Screen"><code class="classname">gtk.VBox</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.14 and above.</p></div><p>The <code class="methodname">get_content_area</code>() method
returns the content area of dialog.</p></div></div><div class="refsect1" title="Functions"><a name="id3670609"></a><h2>Functions</h2><div class="refsect2" title="gtk.alternative_dialog_button_order"><a name="function-gtk--alternative-dialog-button-order"></a><h3>gtk.alternative_dialog_button_order</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.alternative_dialog_button_order</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>screen</code></strong></span><span class="initializer">=None</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>screen</code></strong> :</span></p></td><td>the <a class="link" href="class-gdkscreen.html" title="gtk.gdk.Screen"><code class="classname">gtk.gdk.Screen</code></a> or <code class="literal">None</code> to use the default screen</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the alternative button order should be used</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 function is available in PyGTK 2.10 and above.</p></div><p>The <code class="function">gtk.alternative_dialog_button_order</code>()
returns <code class="literal">True</code> if the alternative button order should be
used for the <a class="link" href="class-gdkscreen.html" title="gtk.gdk.Screen"><code class="classname">gtk.gdk.Screen</code></a>
specified by <em class="parameter"><code>screen</code></em>. If <em class="parameter"><code>screen</code></em>
is <code class="literal">None</code> the default <a class="link" href="class-gdkscreen.html" title="gtk.gdk.Screen"><code class="classname">gtk.gdk.Screen</code></a> is used.</p></div></div><div class="refsect1" title="Signals"><a name="id3670774"></a><h2>Signals</h2><div class="refsect2" title='The "close" gtk.Dialog Signal'><a name="signal-gtkdialog--close"></a><h3>The "close" gtk.Dialog Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>dialog</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>dialog</code></em> :</span></p></td><td>the dialog 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><p>The "close" signal is emitted when the dialog is closed.</p></div><div class="refsect2" title='The "response" gtk.Dialog Signal'><a name="signal-gtkdialog--response"></a><h3>The "response" gtk.Dialog Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>dialog</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>response_id</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>dialog</code></em> :</span></p></td><td>the dialog that received the signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>response_id</code></em> :</span></p></td><td>the response id received by the dialog</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><p>The "response" signal is emitted when an action_area widget is
activated (button "clicked"), the dialog receives a delete_event or the
application calls the <a class="link" href="class-gtkdialog.html#method-gtkdialog--response" title="gtk.Dialog.response"><code class="methodname">response</code>()</a>
method. When a delete_event triggers the "response" signal the
<em class="parameter"><code>response_id</code></em> will be
<code class="literal">gtk.RESPONSE_DELETE_EVENT</code>.</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-gtkcurve.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-gtkdrawingarea.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Curve </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.DrawingArea</td></tr></table></div></body></html>
|