/usr/share/gtk-doc/html/pygtk/class-gtktooltip.html is in python-gtk2-doc 2.24.0-4.
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 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Tooltip</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-gtktoolshell.html" title="gtk.ToolShell"><link rel="next" href="class-gtktooltips.html" title="gtk.Tooltips"></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.Tooltip</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtktoolshell.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtktooltips.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.Tooltip"><a name="class-gtktooltip"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Tooltip</h2><p>gtk.Tooltip — Add tips to your widgets (new in PyGTK 2.12)</p></div><div class="refsect1" title="Synopsis"><a name="id4014062"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Tooltip</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-custom" title="gtk.Tooltip.set_custom">set_custom</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-gtktooltip.html#method-gtktooltip--set-icon" title="gtk.Tooltip.set_icon">set_icon</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>pixbuf</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-icon-from-stock" title="gtk.Tooltip.set_icon_from_stock">set_icon_from_icon_name</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon_name</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-icon-from-stock" title="gtk.Tooltip.set_icon_from_stock">set_icon_from_stock</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-icon-from-gicon" title="gtk.Tooltip.set_icon_from_gicon">set_icon_from_gicon</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>gicon</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-markup" title="gtk.Tooltip.set_markup">set_markup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>markup</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-text" title="gtk.Tooltip.set_text">set_text</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>text</code></strong></span></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-gtktooltip.html#function-gtk--tooltip-trigger-tooltip-query" title="gtk.tooltip_trigger_tooltip_query">gtk.tooltip_trigger_tooltip_query</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>display</code></strong></span></span>)</code></pre></div><div class="refsect1" title="Ancestry"><a name="id4014362"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gtktooltip.html" title="gtk.Tooltip">gtk.Tooltip</a>
</pre></div><div class="refsect1" title="Description"><a name="id4014388"></a><h2>Description</h2><p>
<a class="link" href="class-gtktooltip.html" title="gtk.Tooltip"><code class="classname">gtk.Tooltip</code></a>
belongs to the new tooltips API that was introduced in GTK+ 2.12 and which
deprecates the old <a class="link" href="class-gtktooltips.html" title="gtk.Tooltips"><code class="classname">gtk.Tooltips</code></a> API.
</p><p>
Basic tooltips can be realized simply by using
<code class="methodname"><a class="link" href="class-gtkwidget.html#method-gtkwidget--set-tooltip-text" title="gtk.Widget.set_tooltip_text">gtk.Widget.set_tooltip_text</a></code>() or
<code class="methodname"><a class="link" href="class-gtkwidget.html#method-gtkwidget--set-tooltip-markup" title="gtk.Widget.set_tooltip_markup">gtk.Widget.set_tooltip_markup</a></code>()
without any explicit tooltip object.
</p><p>
When you need a tooltip with a little more fancy contents, like adding an image,
or you want the tooltip to have different contents per
<a class="link" href="class-gtktreeview.html" title="gtk.TreeView"><code class="classname">gtk.TreeView</code></a> row or cell,
you will have to do a little more work:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
Set the GtkWidget:has-tooltip property to <code class="literal">True</code>,
this will make GTK+ monitor the widget for motion and related events
which are needed to determine when and where to show a tooltip.
</li><li class="listitem">
Connect to the <a class="link" href="class-gtkwidget.html#signal-gtkwidget--query-tooltip" title='The "query-tooltip" gtk.Widget Signal'>GtkWidget::query-tooltip</a>
signal. This signal will be emitted
when a tooltip is supposed to be shown. One of the arguments passed to the
signal handler is a
<a class="link" href="class-gtktooltip.html" title="gtk.Tooltip"><code class="classname">gtk.Tooltip</code></a>
object. This is the object that we are about
to display as a tooltip, and can be manipulated in your callback using functions
like <code class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-icon" title="gtk.Tooltip.set_icon">set_icon</a></code>.
There are functions for setting the tooltip's markup,
setting an image from a stock icon, or even putting in a custom widget.
</li><li class="listitem">
Return <code class="literal">True</code> from your query-tooltip handler. This causes the
tooltip to be show. If you return <code class="literal">False</code>, it will not be shown.
</li></ul></div><p>
In the probably rare case where you want to have even more control over the tooltip that
is about to be shown, you can set your own
<a class="link" href="class-gtkwindow.html" title="gtk.Window"><code class="classname">gtk.Window</code></a> which will be used as tooltip window.
This works as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
Set GtkWidget:has-tooltip and connect to
<a class="link" href="class-gtkwidget.html#signal-gtkwidget--query-tooltip" title='The "query-tooltip" gtk.Widget Signal'>GtkWidget::query-tooltip</a>
as before.
</li><li class="listitem">
Use <code class="methodname"><a class="link" href="class-gtkwidget.html#method-gtkwidget--set-tooltip-window" title="gtk.Widget.set_tooltip_window">gtk.Widget.set_tooltip_window</a></code>()
to set a <a class="link" href="class-gtkwindow.html" title="gtk.Window"><code class="classname">gtk.Window</code></a> created by you as tooltip window.
</li><li class="listitem">
In the ::query-tooltip callback you can access your window using
<code class="methodname"><a class="link" href="class-gtkwidget.html#method-gtkwidget--get-tooltip-window" title="gtk.Widget.get_tooltip_window">gtk.Widget.get_tooltip_window</a></code>()
and manipulate as you wish. The semantics of the return value are exactly as before,
return <code class="literal">True</code> to show the window, <code class="literal">False</code> to not show it.
</li></ul></div></div><div class="refsect1" title="Methods"><a name="id4014633"></a><h2>Methods</h2><div class="refsect2" title="gtk.Tooltip.set_custom"><a name="method-gtktooltip--set-custom"></a><h3>gtk.Tooltip.set_custom</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_custom</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>widget</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>widget</code></strong> :</span></p></td><td>A
<a class="link" href="class-gtkwidget.html" title="gtk.Widget"><code class="classname">gtk.Widget</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.12 and above.</p></div><p>
The <code class="methodname">set_custom</code>() method replaces the widget packed into
the tooltip with custom_widget. By default a box with a
<a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> and
<a class="link" href="class-gtklabel.html" title="gtk.Label"><code class="classname">gtk.Label</code></a> is
embedded in the tooltip, which can be configured using
<code class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-markup" title="gtk.Tooltip.set_markup">set_markup</a></code> and
<code class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-icon" title="gtk.Tooltip.set_icon">set_icon</a></code>.
</p></div><div class="refsect2" title="gtk.Tooltip.set_icon"><a name="method-gtktooltip--set-icon"></a><h3>gtk.Tooltip.set_icon</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_value</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>pixbuf</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>pixbuf</code></strong> :</span></p></td><td>A
<a class="link" href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><code class="classname">gtk.gdk.Pixbuf</code></a>
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.12 and above.</p></div><p>
The <code class="methodname">set_icon</code>() method sets the icon of the tooltip
(which is in front of the text) to be pixbuf.
If <em class="parameter"><code>pixbuf</code></em> is <code class="literal">None</code>, the image will be hidden.
</p></div><div class="refsect2" title="gtk.Tooltip.set_icon_from_icon_name"><a name="method-gtktooltip--set-icon-from-icon-name"></a><h3>gtk.Tooltip.set_icon_from_icon_name</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_icon_from_icon_name</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>icon_name</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>size</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>icon_name</code></strong> :</span></p></td><td>an icon name, or <code class="literal">None</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>A stock icon size.</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">set_icon_from_icon_name</code>() method sets the icon of the tooltip
(which is in front of the text) to be the icon indicated by <em class="parameter"><code>icon_name</code></em>
with the size indicated by <em class="parameter"><code>size</code></em>. If icon_name is <code class="literal">None</code>,
the image will be hidden.
</p></div><div class="refsect2" title="gtk.Tooltip.set_icon_from_stock"><a name="method-gtktooltip--set-icon-from-stock"></a><h3>gtk.Tooltip.set_icon_from_stock</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_icon_from_stock</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>stock_id</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>size</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>stock_id</code></strong> :</span></p></td><td>A stock icon name, or <code class="literal">None</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>A stock icon size.</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.12 and above.</p></div><p>
The <code class="methodname">set_icon_from_stock</code>() method sets the icon of the tooltip
(which is in front of the text) to be the stock item indicated by <em class="parameter"><code>stock_id</code></em>
with the size indicated by <em class="parameter"><code>size</code></em>. If stock_id is <code class="literal">None</code>,
the image will be hidden.
</p></div><div class="refsect2" title="gtk.Tooltip.set_icon_from_gicon"><a name="method-gtktooltip--set-icon-from-gicon"></a><h3>gtk.Tooltip.set_icon_from_gicon</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_icon_from_gicon</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>gicon</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</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>gicon</code></strong> :</span></p></td><td>the icon to set, or <code class="literal">None</code>..</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>a stock icon size.</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">set_icon_from_gicon</code>() method sets the icon of the
tooltip (which is in front of the text) to be the icon indicated by <em class="parameter"><code>gicon</code></em>
with the size indicated by <em class="parameter"><code>size</code></em>. If gicon is <code class="literal">None</code>,
the image will be hidden.</p></div><div class="refsect2" title="gtk.Tooltip.set_markup"><a name="method-gtktooltip--set-markup"></a><h3>gtk.Tooltip.set_markup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_markup</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>markup</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>markup</code></strong> :</span></p></td><td>A markup string (see Pango markup format)
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.12 and above.</p></div><p>
The <code class="methodname">set_markup</code>() method sets the text of the tooltip to be
<em class="parameter"><code>markup</code></em>, which is marked up with the Pango text markup language.
If <em class="parameter"><code>markup</code></em> is <code class="literal">None</code>, the label will be hidden.
</p></div><div class="refsect2" title="gtk.Tooltip.set_text"><a name="method-gtktooltip--set-text"></a><h3>gtk.Tooltip.set_text</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_text</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>text</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>text</code></strong> :</span></p></td><td>A text string 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.12 and above.</p></div><p>
The <code class="methodname">set_text</code>() method sets the text of the tooltip to be text.
If text is <code class="literal">None</code>, the label will be hidden. See also
<code class="methodname"><a class="link" href="class-gtktooltip.html#method-gtktooltip--set-markup" title="gtk.Tooltip.set_markup">set_markup</a></code>.
</p></div></div><div class="refsect1" title="Functions"><a name="id4015488"></a><h2>Functions</h2><div class="refsect2" title="gtk.tooltip_trigger_tooltip_query"><a name="function-gtk--tooltip-trigger-tooltip-query"></a><h3>gtk.tooltip_trigger_tooltip_query</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">tooltip_trigger_tooltip_query</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>display</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>display</code></strong> :</span></p></td><td>A
<a class="link" href="class-gdkdisplay.html" title="gtk.gdk.Display"><code class="classname">gtk.gdk.Display</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 function is available in PyGTK 2.12 and above.</p></div><p>
The <code class="methodname">tooltip_trigger_tooltip_query</code>() function triggers a
new tooltip query on display, in order to update the current visible tooltip,
or to show/hide the current tooltip. This function is useful to call when, for example,
the state of the widget changed by a key press.
</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-gtktoolshell.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-gtktooltips.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.ToolShell </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.Tooltips</td></tr></table></div></body></html>
|