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
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.MessageDialog</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-gtkmenutoolbutton.html" title="gtk.MenuToolButton"><link rel="next" href="class-gtkmisc.html" title="gtk.Misc"></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.MessageDialog</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkmenutoolbutton.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkmisc.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkmessagedialog"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.MessageDialog</h2><p>gtk.MessageDialog — a convenient message window</p></div><div class="refsect1" lang="en"><a name="id3393896"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.MessageDialog</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkdialog.html" title="gtk.Dialog">gtk.Dialog</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtkmessagedialog.html#constructor-gtkmessagedialog" title="Constructor">gtk.MessageDialog</a></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>type</code></strong></span><span class="initializer">=gtk.MESSAGE_INFO</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>buttons</code></strong></span><span class="initializer">=gtk.BUTTONS_NONE</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>message_format</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmessagedialog.html#method-gtkmessagedialog--set-markup" title="gtk.MessageDialog.set_markup">set_markup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmessagedialog.html#method-gtkmessagedialog--format-secondary-text" title="gtk.MessageDialog.format_secondary_text">format_secondary_text</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>message_format</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmessagedialog.html#method-gtkmessagedialog--format-secondary-markup" title="gtk.MessageDialog.format_secondary_markup">format_secondary_markup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>message_format</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmessagedialog.html#method-gtkmessagedialog--set-image" title="gtk.MessageDialog.set_image">set_image</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>image</code></strong></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3394138"></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>
+-- <a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog">gtk.MessageDialog</a>
</pre></div><div class="refsect1" lang="en"><a name="id3394202"></a><h2>Implemented Interfaces</h2><p>
<a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</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" lang="en"><a name="properties-gtkmessagedialog"></a><h2>gtk.MessageDialog 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><p><a class="link" href="class-gtkdialog.html#properties-gtkdialog" title="gtk.Dialog Properties">gtk.Dialog 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">"buttons"</td><td valign="top">Write-Construct</td><td valign="top">The buttons shown in the message dialog. One of the
<a class="xref" href="gtk-constants.html#gtk-buttons-type-constants" title="GTK Buttons Type Constants">GTK Buttons Type Constants</a>:
<code class="literal">gtk.BUTTONS_NONE</code>,
<code class="literal">gtk.BUTTONS_OK</code>,
<code class="literal">gtk.BUTTONS_CLOSE</code>,
<code class="literal">gtk.BUTTONS_CANCEL</code>,
<code class="literal">gtk.BUTTONS_YES_NO</code>,
<code class="literal">gtk.BUTTONS_OK_CANCEL</code>. Default value:
<code class="literal">gtk.BUTTONS_NONE</code></td></tr><tr valign="top"><td valign="top">"image"</td><td valign="top">Read-Write</td><td valign="top">The image for this dialog. Available in GTK+
2.10.</td></tr><tr valign="top"><td valign="top">"message-type"</td><td valign="top">Read-Write-Construct</td><td valign="top">The type of message. One of the
<a class="xref" href="gtk-constants.html#gtk-message-type-constants" title="GTK Message Type Constants">GTK Message Type Constants</a>:
<code class="literal">gtk.MESSAGE_INFO</code>, <code class="literal">gtk.MESSAGE_WARNING</code>,
<code class="literal">gtk.MESSAGE_QUESTION</code> or
<code class="literal">gtk.MESSAGE_ERROR</code>. Default value:
<code class="literal">gtk.MESSAGE_INFO</code></td></tr><tr valign="top"><td valign="top">"secondary-text"</td><td valign="top">Read-Write</td><td valign="top">The secondary text of the message dialog. Default
value: <code class="literal">None</code>. Available in GTK+
2.10.</td></tr><tr valign="top"><td valign="top">"secondary-use-markup"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code> the secondary text of the
dialog includes Pango markup. See the <a class="link" href="class-pangoattrlist.html#function-pango--parse-markup" title="pango.parse_markup"><code class="function">pango.parse_markup</code>()</a>
function. Default value: <code class="literal">False</code>. Available
in GTK+ 2.10.</td></tr><tr valign="top"><td valign="top">"text"</td><td valign="top">Read-Write</td><td valign="top">The primary text of the message dialog. If the dialog
has a secondary text, this will appear as the title. Default
value: <code class="literal">None</code>. Available in GTK+
2.10.</td></tr><tr valign="top"><td valign="top">"use-markup"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code> the primary text of the
dialog includes Pango markup. See the <a class="link" href="class-pangoattrlist.html#function-pango--parse-markup" title="pango.parse_markup"><code class="function">pango.parse_markup</code>()</a>
function. Default value: <code class="literal">False</code>. Available
in GTK+ 2.10.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="style-properties-gtkmessagedialog"></a><h2>gtk.MessageDialog Style Properties</h2><p><a class="link" href="class-gtkwidget.html#style-properties-gtkwidget" title="gtk.Widget Style Properties">gtk.Widget Style Properties</a></p><p><a class="link" href="class-gtkdialog.html#style-properties-gtkdialog" title="gtk.Dialog Style Properties">gtk.Dialog 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><col><col></colgroup><tbody><tr valign="top"><td valign="top">"message-border"</td><td valign="top">Read-Write</td><td valign="top">The width of border around the label and image in the
message dialog. Allowed values: >= 0. Default value: 12.</td></tr><tr valign="top"><td valign="top">"use-separator"</td><td valign="top">Read</td><td valign="top">If <code class="literal">True</code> draw a separator line between
the message label and the buttons in the dialog. This property is
available in GTK+ 2.4 and above.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3394716"></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">"image"</td><td valign="top">Read</td><td valign="top">The stock ID image</td></tr><tr valign="top"><td valign="top">"label"</td><td valign="top">Read</td><td valign="top">The label widget that contains the message
text.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="signal-prototypes-gtkmessagedialog"></a><h2>gtk.MessageDialog 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><p><a class="link" href="class-gtkdialog.html#signal-prototypes-gtkdialog" title="gtk.Dialog Signal Prototypes">gtk.Dialog Signal Prototypes</a></p></div><div class="refsect1" lang="en"><a name="id3394864"></a><h2>Description</h2><p>The <a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>
presents a dialog with an image representing the type of message (Error,
Question, etc.) alongside some message text. It's simply a convenience
widget; you could construct the equivalent of <a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>
from <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> without
too much effort, but <a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>
saves time.</p><p>The <a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>
types are listed in the <a class="xref" href="gtk-constants.html#gtk-message-type-constants" title="GTK Message Type Constants">GTK Message Type Constants</a>.</p><p>A selection of predefined button sets is available for use in a
message dialog. See the <a class="xref" href="gtk-constants.html#gtk-buttons-type-constants" title="GTK Buttons Type Constants">GTK Buttons Type Constants</a>.</p><p>See the <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> reference
page for additional methods to be used with the <a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkmessagedialog"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.MessageDialog</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>type</code></strong></span><span class="initializer">=gtk.MESSAGE_INFO</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>buttons</code></strong></span><span class="initializer">=gtk.BUTTONS_NONE</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>message_format</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>parent</code></strong> :</span></p></td><td>the transient parent, or None if
none</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>flags</code></strong> :</span></p></td><td>the dialog flags - a combination of:
<code class="literal">gtk.DIALOG_MODAL</code>,
<code class="literal">gtk.DIALOG_DESTROY_WITH_PARENT</code> or 0 for no
flags</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>type</code></strong> :</span></p></td><td>the type of message:
<code class="literal">gtk.MESSAGE_INFO</code>, <code class="literal">gtk.MESSAGE_WARNING</code>,
<code class="literal">gtk.MESSAGE_QUESTION</code> or
<code class="literal">gtk.MESSAGE_ERROR</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>buttons</code></strong> :</span></p></td><td>the predefined set of buttons to use:
<code class="literal">gtk.BUTTONS_NONE</code>, <code class="literal">gtk.BUTTONS_OK</code>,
<code class="literal">gtk.BUTTONS_CLOSE</code>, <code class="literal">gtk.BUTTONS_CANCEL</code>,
<code class="literal">gtk.BUTTONS_YES_NO</code>,
<code class="literal">gtk.BUTTONS_OK_CANCEL</code></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>message_format</code></strong> :</span></p></td><td>a string containing the message text or
None</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-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>
widget</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gtkmessagedialog.html" title="gtk.MessageDialog"><code class="classname">gtk.MessageDialog</code></a>,
which is a simple dialog with an icon indicating the dialog type (error,
warning, etc.) specified by <em class="parameter"><code>type</code></em> and some text
(<em class="parameter"><code>message_format</code></em>) the user may want to see.
<em class="parameter"><code>parent</code></em> if specified indicates the transient parent of
the dialog. The <em class="parameter"><code>flags</code></em> allow the specification special
dialog characteristics: make the dialog modal
(<code class="literal">gtk.DIALOG_MODAL</code>) and destroy the dialog when the parent is
destroyed (<code class="literal">gtk.DIALOG_DESTROY_WITH_PARENT</code>). When the user
clicks a button a "response" signal is emitted with response IDs.
<em class="parameter"><code>buttons</code></em> specifies the set of predefined buttons to
use: <code class="literal">gtk.BUTTONS_NONE</code>, <code class="literal">gtk.BUTTONS_OK</code>,
<code class="literal">gtk.BUTTONS_CLOSE</code>, <code class="literal">gtk.BUTTONS_CANCEL</code>,
<code class="literal">gtk.BUTTONS_YES_NO</code>,
<code class="literal">gtk.BUTTONS_OK_CANCEL</code>. See <a class="link" href="class-gtkdialog.html" title="gtk.Dialog"><code class="classname">gtk.Dialog</code></a> for more
details.</p></div><div class="refsect1" lang="en"><a name="id3395375"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkmessagedialog--set-markup"></a><h3>gtk.MessageDialog.set_markup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_markup</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</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>str</code></strong> :</span></p></td><td>a markup string (see the <a class="link" href="pango-markup-language.html" title="The Pango Markup Language">Pango markup language</a>
reference)</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_markup</code>() method sets the text
of the message dialog to the contents of <em class="parameter"><code>str</code></em>. If
<em class="parameter"><code>str</code></em> contains text marked up with Pango markup (see
<a class="xref" href="pango-markup-language.html" title="The Pango Markup Language">The Pango Markup Language</a>), it will be displayed with
those attributes. Note the '<', '>' and '&' characters must be
replaced with '&lt;', '&gt;' and '&amp;' respectively to be
displayed literally.</p></div><div class="refsect2" lang="en"><a name="method-gtkmessagedialog--format-secondary-text"></a><h3>gtk.MessageDialog.format_secondary_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">format_secondary_text</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>message_format</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>message_format</code></strong> :</span></p></td><td>The text to be displayed as the secondary text
or <code class="literal">None</code>.</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">format_secondary_text</code>() method sets
the secondary text of the message dialog to the text specified by
<em class="parameter"><code>message_format</code></em>. Note that setting a secondary text
makes the primary text bold, unless you have provided explicit
markup.</p></div><div class="refsect2" lang="en"><a name="method-gtkmessagedialog--format-secondary-markup"></a><h3>gtk.MessageDialog.format_secondary_markup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">format_secondary_markup</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>message_format</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>message_format</code></strong> :</span></p></td><td>A string containing the pango markup to use as
secondary text.</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">format_secondary_markup</code>() method
sets the secondary text to the markup text specified by
<em class="parameter"><code>message_format</code></em>. Note that setting a secondary text
makes the primary text become bold, unless you have provided explicit
markup.</p></div><div class="refsect2" lang="en"><a name="method-gtkmessagedialog--set-image"></a><h3>gtk.MessageDialog.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"><strong class="parameter"><code>image</code></strong> :</span></p></td><td>the image 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.10 and above.</p></div><p>The <code class="methodname">set_image</code>() method sets the
dialog's image to the <a class="link" href="class-gtkwidget.html" title="gtk.Widget"><code class="classname">gtk.Widget</code></a>
specified by <em class="parameter"><code>image</code></em>.</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-gtkmenutoolbutton.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-gtkmisc.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.MenuToolButton </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.Misc</td></tr></table></div></body></html>
|