File: class-gtkdialog.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (170 lines) | stat: -rw-r--r-- 36,977 bytes parent folder | download
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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.Dialog</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-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" lang="en"><a name="class-gtkdialog"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.Dialog</h2><p>gtk.Dialog &#8212; popup windows for user information and action</p></div><div class="refsect1" lang="en"><a name="id3400706"></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 href="class-gtkwindow.html" title="gtk.Window">gtk.Window</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor">gtk.Dialog</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>title</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>parent</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>flags</tt></b></span><span class="initializer">=0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>buttons</tt></b></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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"><b class="parameter"><tt>child</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkdialog.html#method-gtkdialog--add-button" title="gtk.Dialog.add_button">add_button</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>button_text</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkdialog.html#method-gtkdialog--add-buttons" title="gtk.Dialog.add_buttons">add_buttons</a></span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>buttons</tt></i></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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"><b class="parameter"><tt>response_id</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>setting</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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"><b class="parameter"><tt>response_id</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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"><b class="parameter"><tt>setting</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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 href="class-gtkdialog.html#method-gtkdialog--response" title="gtk.Dialog.response">response</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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 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"><b class="parameter"><tt>new_order</tt></b></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3400962"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
  +-- <a href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
    +-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
      +-- <a href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
        +-- <a href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
          +-- <a href="class-gtkwindow.html" title="gtk.Window">gtk.Window</a>
            +-- <a href="class-gtkdialog.html" title="gtk.Dialog">gtk.Dialog</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3401008"></a><h2>Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"has-separator"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt>, the dialog has a separator bar
above its buttons</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3401072"></a><h2>Style Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"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">"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">"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" lang="en"><a name="id3401164"></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><col><col></colgroup><tbody><tr valign="top"><td valign="top">"vbox"</td><td valign="top">Read</td><td valign="top">A <a href="class-gtkvbox.html" title="gtk.VBox"><tt class="classname">gtk.VBox</tt></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 href="class-gtkhbox.html" title="gtk.HBox"><tt class="classname">gtk.HBox</tt></a> that contains
the buttons of the dialog.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3401256"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">"<a href="class-gtkdialog.html#signal-gtkdialog--close" title='The "close" gtk.Dialog Signal'>close</a>"</span></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>dialog</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr><tr><td><span class="term">"<a href="class-gtkdialog.html#signal-gtkdialog--response" title='The "response" gtk.Dialog Signal'>response</a>"</span></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>dialog</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>response_id</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3401347"></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 href="class-gtkvbox.html" title="gtk.VBox"><tt class="classname">gtk.VBox</tt></a>, and is where
widgets such as a <a href="class-gtklabel.html" title="gtk.Label"><tt class="classname">gtk.Label</tt></a> or a <a href="class-gtkentry.html" title="gtk.Entry"><tt class="classname">gtk.Entry</tt></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 href="class-gtkhseparator.html" title="gtk.HSeparator"><tt class="classname">gtk.HSeparator</tt></a>.</p><p>The <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a> boxes are
created with a call to <a href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor"><tt class="methodname">gtk.Dialog</tt>()</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. A modal dialog (that is, one which freezes the rest of the
application from user input), can be created by passing the
<tt class="literal">gtk.DIALOG_MODAL</tt> flag to the <a href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor"><tt class="methodname">gtk.Dialog</tt>()</a>
constructor or by calling <a href="class-gtkwindow.html#method-gtkwindow--set-modal" title="gtk.Window.set_modal"><tt class="methodname">set_modal</tt>()</a> 
on the dialog.</p><p>If you add buttons to <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a> using
<a href="class-gtkdialog.html#constructor-gtkdialog" title="Constructor"><tt class="methodname">gtk.Dialog</tt>()</a>, 
<a href="class-gtkdialog.html#method-gtkdialog--add-button" title="gtk.Dialog.add_button"><tt class="methodname">add_button</tt>()</a>, 
or <a href="class-gtkdialog.html#method-gtkdialog--add-action-widget" title="gtk.Dialog.add_action_widget"><tt class="methodname">add_action_widget</tt>()</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 response IDs (these all have values less than zero):</p><div class="itemizedlist"><ul type="disc"><li><tt class="literal">gtk.RESPONSE_NONE</tt></li><li><tt class="literal">gtk.RESPONSE_REJECT</tt></li><li><tt class="literal">gtk.RESPONSE_ACCEPT</tt></li><li><tt class="literal">gtk.RESPONSE_DELETE_EVENT</tt></li><li><tt class="literal">gtk.RESPONSE_OK</tt></li><li><tt class="literal">gtk.RESPONSE_CANCEL</tt></li><li><tt class="literal">gtk.RESPONSE_CLOSE</tt></li><li><tt class="literal">gtk.RESPONSE_YES</tt></li><li><tt class="literal">gtk.RESPONSE_NO</tt></li><li><tt class="literal">gtk.RESPONSE_APPLY</tt></li><li><tt class="literal">gtk.RESPONSE_HELP</tt></li></ul></div><p>If a dialog receives a delete event, the "response" signal will be
emitted with a response ID of <tt class="literal">gtk.RESPONSE_NONE</tt>.</p><p>If you want to block waiting for a dialog to return before
returning control flow to your code, you can call <a href="class-gtkdialog.html#method-gtkdialog--run" title="gtk.Dialog.run"><tt class="methodname">run</tt>()</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" lang="en"><a name="constructor-gtkdialog"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.Dialog</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>title</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>parent</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>flags</tt></b></span><span class="initializer">=0</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>buttons</tt></b></span><span class="initializer">=None</span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>title</tt></b>:</span></td><td>The title of the dialog, or
<tt class="literal">None</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>parent</tt></b>:</span></td><td>The transient parent of the dialog, or
<tt class="literal">None</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>flags</tt></b>:</span></td><td>flags that control the operation of the
dialog</td></tr><tr><td><span class="term"><b class="parameter"><tt>buttons</tt></b>:</span></td><td>a tuple containing button text/response id pairs
or <tt class="literal">None</tt></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a></td></tr></tbody></table><p>Creates a new <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a> with the
title text specified by <i class="parameter"><tt>title</tt></i> (or
<tt class="literal">None</tt> for the default title; see <a href="class-gtkwindow.html#method-gtkwindow--set-title" title="gtk.Window.set_title"><tt class="methodname">gtk.Window.set_title</tt>()</a>) 
and transient parent window specified by <i class="parameter"><tt>parent</tt></i> (or
<tt class="literal">None</tt> for none; see <a href="class-gtkwindow.html#method-gtkwindow--set-transient-for" title="gtk.Window.set_transient_for"><tt class="methodname">gtk.Window.set_transient_for</tt>()</a>). 
The <i class="parameter"><tt>flags</tt></i> argument can be used to make the dialog
modal (<tt class="literal">gtk.DIALOG_MODAL</tt>) and/or to have it destroyed
along with its transient parent
(<tt class="literal">gtk.DIALOG_DESTROY_WITH_PARENT</tt>) and/or remove the
separator (<tt class="literal">gtk.DIALOG_NO_SEPARATOR</tt>). After
<i class="parameter"><tt>flags</tt></i>, a tuple of button text/response ID pairs
should be listed, or <tt class="literal">None</tt> (the default value) is no
buttons are needed. The button text can be either a stock ID such as
<tt class="literal">gtk.STOCK_OK</tt>, or some arbitrary text.  A response ID can
be any positive number, or one of the pre-defined values:</p><div class="itemizedlist"><ul type="disc"><li><tt class="literal">gtk.RESPONSE_NONE</tt></li><li><tt class="literal">gtk.RESPONSE_REJECT</tt></li><li><tt class="literal">gtk.RESPONSE_ACCEPT</tt></li><li><tt class="literal">gtk.RESPONSE_DELETE_EVENT</tt></li><li><tt class="literal">gtk.RESPONSE_OK</tt></li><li><tt class="literal">gtk.RESPONSE_CANCEL</tt></li><li><tt class="literal">gtk.RESPONSE_CLOSE</tt></li><li><tt class="literal">gtk.RESPONSE_YES</tt></li><li><tt class="literal">gtk.RESPONSE_NO</tt></li><li><tt class="literal">gtk.RESPONSE_APPLY</tt></li><li><tt class="literal">gtk.RESPONSE_HELP</tt></li></ul></div><p>If the user clicks one of these dialog buttons, the <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a> will emit
the "response" signal with the corresponding response ID. If a <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a> receives
the "delete_event" signal, it will emit "response" with a response ID of
<tt class="literal">gtk.RESPONSE_DELETE_EVENT</tt>. However, destroying a dialog
does not emit the "response" signal; so be careful relying on "response"
when using the <tt class="literal">gtk.DIALOG_DESTROY_WITH_PARENT</tt> 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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  dialog = gtk.Dialog("My dialog",
                     main_app_window,
                     gtk.DIALOG_MODAL | gtk_.DIALOG_DESTROY_WITH_PARENT,
                     (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                      gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3401910"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkdialog--add-action-widget"></a><h3>gtk.Dialog.add_action_widget</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add_action_widget</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>child</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>child</tt></b>:</span></td><td>an activatable widget</td></tr><tr><td><span class="term"><b class="parameter"><tt>response_id</tt></b>:</span></td><td>a response ID</td></tr></tbody></table><p>The <tt class="methodname">add_action_widget</tt>() method adds an
activatable widget to the action area of a <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></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 <tt class="literal">action_area</tt>.</p></div><div class="refsect2" lang="en"><a name="method-gtkdialog--add-button"></a><h3>gtk.Dialog.add_button</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add_button</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>button_text</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>button_text</tt></b>:</span></td><td>the text of the button, or a stock
ID</td></tr><tr><td><span class="term"><b class="parameter"><tt>response_id</tt></b>:</span></td><td>the response ID for the
button</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the button widget that was
added</td></tr></tbody></table><p>The <tt class="methodname">add_button</tt>() method adds a button
with the text specified by <i class="parameter"><tt>button_text</tt></i> (or a stock
button, if <i class="parameter"><tt>button_text</tt></i> is a stock ID) and sets things
up so that clicking the button will emit the "response" signal with the
specified <i class="parameter"><tt>response_id</tt></i>. 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" lang="en"><a name="method-gtkdialog--add-buttons"></a><h3>gtk.Dialog.add_buttons</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add_buttons</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>buttons</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>buttons</tt></i>:</span></td><td>a tuple containing 2-tuples each containing
button text (or stock ID) and a response id</td></tr></tbody></table><p>The <tt class="methodname">add_buttons</tt>() method adds several
buttons to the <a href="class-gtkdialog.html" title="gtk.Dialog"><tt class="classname">gtk.Dialog</tt></a> using the
data specified in <i class="parameter"><tt>buttons</tt></i>. This method is the same as
calling the <a href="class-gtkdialog.html#method-gtkdialog--add-button" title="gtk.Dialog.add_button"><tt class="methodname">gtk.Dialog.add_button</tt>()</a> 
repeatedly. buttons is a tuple containing 2-tuples specifying the data for
one button - button text and a response ID integer.</p></div><div class="refsect2" lang="en"><a name="method-gtkdialog--set-response-sensitive"></a><h3>gtk.Dialog.set_response_sensitive</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_response_sensitive</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>setting</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>response_id</tt></b>:</span></td><td>a response ID</td></tr><tr><td><span class="term"><b class="parameter"><tt>setting</tt></b>:</span></td><td>the new value for
sensitive</td></tr></tbody></table><p>The <tt class="methodname">set_response_sensitive</tt>() method
calls the <a href="class-gtkwidget.html#method-gtkwidget--set-sensitive" title="gtk.Widget.set_sensitive"><tt class="methodname">gtk.Window.set_sensitive</tt>()</a> 
method with the specified <i class="parameter"><tt>response_id</tt></i> 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" lang="en"><a name="method-gtkdialog--set-default-response"></a><h3>gtk.Dialog.set_default_response</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_default_response</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>response_id</tt></b>:</span></td><td>a response ID</td></tr></tbody></table><p>The <tt class="methodname">set_default_response</tt>() method sets
the last widget in the dialog's action area with the specified
<i class="parameter"><tt>response_id</tt></i> as the default widget for the dialog.
Pressing <span><b class="keycap">Enter</b></span> normally activates the default
widget.</p></div><div class="refsect2" lang="en"><a name="method-gtkdialog--set-has-separator"></a><h3>gtk.Dialog.set_has_separator</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_has_separator</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>setting</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>setting</tt></b>:</span></td><td>If <tt class="literal">TRUE</tt> use a
separator</td></tr></tbody></table><p>The <tt class="methodname">set_has_separator</tt>() method sets the
"has-separator" property to the value of <i class="parameter"><tt>setting</tt></i>. If
<i class="parameter"><tt>setting</tt></i> is <tt class="literal">TRUE</tt> (the default
value) the dialog has a separator above the buttons.</p></div><div class="refsect2" lang="en"><a name="method-gtkdialog--get-has-separator"></a><h3>gtk.Dialog.get_has_separator</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_has_separator</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the value of the "has-separator"
property</td></tr></tbody></table><p>The <tt class="methodname">get_has_separator</tt>() method returns
the value of the "has-separator" property.</p></div><div class="refsect2" lang="en"><a name="method-gtkdialog--response"></a><h3>gtk.Dialog.response</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">response</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>response_id</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>response_id</tt></b>:</span></td><td>response ID</td></tr></tbody></table><p>The <tt class="methodname">response</tt>() method emits the
"response" signal with the value specified in
<i class="parameter"><tt>response_id</tt></i>. This method is used to indicate that the
user has responded to the dialog in some way; typically either you or <a href="class-gtkdialog.html#method-gtkdialog--run" title="gtk.Dialog.run"><tt class="function">gtk.Dialog.run()</tt></a>
will be monitoring the "response" signal and take appropriate action.</p></div><div class="refsect2" lang="en"><a name="method-gtkdialog--run"></a><h3>gtk.Dialog.run</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">run</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a response ID</td></tr></tbody></table><p>The <tt class="methodname">run</tt>() method blocks in a recursive
main loop until the dialog either emits the "response" signal, or is
destroyed. If the dialog is destroyed, the <tt class="methodname">run</tt>()
method returns <tt class="literal">gtk.RESPONSE_NONE</tt>; otherwise, it returns
the response ID from the "response" signal emission. Before entering the
recursive main loop, the <tt class="methodname">run</tt>() method calls the
<a href="class-gtkwidget.html#method-gtkwidget--show" title="gtk.Widget.show"><tt class="methodname">gtk.Widget.show</tt>()</a> 
on the dialog for you. Note that you still need to show any children of the
dialog yourself.</p><p>During the <tt class="methodname">run</tt>() 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
<tt class="methodname">run</tt>() method will return
<tt class="literal">gtk.RESPONSE_DELETE_EVENT</tt>. Also, during the
<tt class="methodname">run</tt>() method the dialog will be modal. You can
force the <tt class="methodname">run</tt>() method to return at any time by
calling <a href="class-gtkdialog.html#method-gtkdialog--response" title="gtk.Dialog.response"><tt class="methodname">response</tt>()</a> 
to emit the "response" signal. Destroying the dialog during the
<tt class="methodname">run</tt>() 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 <tt class="methodname">run</tt>() method returns, you are
responsible for hiding or destroying the dialog as needed.</p></div><div class="refsect2" lang="en"><a name="method-gtkdialog--set-alternative-button-order"></a><h3>gtk.Dialog.set_alternative_button_order</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_alternative_button_order</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>new_order</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>new_order</tt></b>:</span></td><td>a sequence containing response id
integer values</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 <tt class="methodname">set_alternative_button_order</tt>()
method sets an alternative button order for the dialog based on the sequence
of response ids specified by <i class="parameter"><tt>new_order</tt></i>. If the
"gtk-alternative-button-order" property of the <a href="class-gtksettings.html" title="gtk.Settings"><tt class="classname">gtk.Settings</tt></a>
object is set to <tt class="literal">TRUE</tt>, 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 href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><tt class="classname">gtk.MessageDialog</tt></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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><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></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3402692"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gtkdialog--close"></a><h3>The "close" gtk.Dialog Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>dialog</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>dialog</tt></i>:</span></td><td>the dialog that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "close" signal is emitted when the dialog is closed.</p></div><div class="refsect2" lang="en"><a name="signal-gtkdialog--response"></a><h3>The "response" gtk.Dialog Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>dialog</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>response_id</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>dialog</tt></i>:</span></td><td>the dialog that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>response_id</tt></i>:</span></td><td>the response id received by the
dialog</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr></tbody></table><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 href="class-gtkdialog.html#method-gtkdialog--response" title="gtk.Dialog.response"><tt class="methodname">response</tt>()</a> 
method. When a delete_event triggers the "response" signal the
<i class="parameter"><tt>response_id</tt></i> will be
<tt class="literal">gtk.RESPONSE_NONE</tt>.</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>