This file is indexed.

/usr/share/doc/python-gtk2-tutorial/html/sec-TooltipsObject.html is in python-gtk2-tutorial 2.4-1.

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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>9.3. The Tooltips Object</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Tutorial"><link rel="up" href="ch-MiscellaneousWidgets.html" title="Chapter 9. Miscellaneous Widgets"><link rel="previous" href="sec-Arrows.html" title="9.2. Arrows"><link rel="next" href="sec-ProgressBars.html" title="9.4. Progress Bars"></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">9.3. The Tooltips Object</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-Arrows.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Miscellaneous Widgets</th><td width="20%" align="right"> <a accesskey="n" href="sec-ProgressBars.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec-TooltipsObject"></a>9.3. The Tooltips Object</h2></div></div><div></div></div><p><tt class="classname">Tooltips</tt> are the little text strings that
pop up when you leave your pointer over a button or other widget for a few
seconds.</p><p>Widgets that do not receive events (widgets that do not have
their own window) will not work with tooltips.</p><p>The first call you will use creates a new tooltip. You only need
to do this once for a set of tooltips as the
<tt class="classname">gtk.Tooltips</tt> object this function returns can be used
to create multiple tooltips.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tooltips = gtk.Tooltips()
</pre></td></tr></table><p>Once you have created a new tooltip, and the widget you wish to use it
on, simply use this call to set it:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tooltips.set_tip(<b class="parameter"><tt>widget</tt></b>, <b class="parameter"><tt>tip_text</tt></b>, <b class="parameter"><tt>tip_private</tt></b>=None)
</pre></td></tr></table><p>The object <i class="parameter"><tt>tooltips</tt></i> is the tooltip you've
already created. The first argument (<i class="parameter"><tt>widget</tt></i>) is the
widget you wish to have this tooltip pop up for; the second
(<i class="parameter"><tt>tip_text</tt></i>), the text you wish it to display. The last
argument (<i class="parameter"><tt>tip_private</tt></i>) is a text string that can be
used as an identifier.</p><p>The <a href="examples/tooltip.py" target="_top"><span><b class="command">tooltip.py</b></span></a> example
program modifies the <a href="examples/arrow.py" target="_top"><span><b class="command">arrow.py</b></span></a> program to add a
tooltip for each button. <a href="sec-TooltipsObject.html#tooltipsfig" title="Figure 9.3. Tooltips Example">Figure 9.3, &#8220;Tooltips Example&#8221;</a> illustrates the
resulting display with the tooltip for the second arrow button
displayed:</p><div class="figure"><a name="tooltipsfig"></a><p class="title"><b>Figure 9.3. Tooltips Example</b></p><div class="mediaobject" align="center"><img src="figures/tooltips.png" align="middle" alt="Tooltips Example"></div></div><p>The source code for <a href="examples/tooltip.py" target="_top"><span><b class="command">tooltip.py</b></span></a> is:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
    1	#!/usr/bin/env python
    2	
    3	# example tooltip.py
    4	
    5	import pygtk
    6	pygtk.require('2.0')
    7	import gtk
    8	
    9	# Create an Arrow widget with the specified parameters
   10	# and pack it into a button
   11	def create_arrow_button(arrow_type, shadow_type):
   12	    button = gtk.Button()
   13	    arrow = gtk.Arrow(arrow_type, shadow_type)
   14	    button.add(arrow)
   15	    button.show()
   16	    arrow.show()
   17	    return button
   18	
   19	class Tooltips:
   20	    def __init__(self):
   21	        # Create a new window
   22	        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
   23	
   24	        window.set_title("Tooltips")
   25	
   26	        # It's a good idea to do this for all windows.
   27	        window.connect("destroy", lambda w: gtk.main_quit())
   28	
   29	        # Sets the border width of the window.
   30	        window.set_border_width(10)
   31	
   32	        # Create a box to hold the arrows/buttons
   33	        box = gtk.HBox(False, 0)
   34	        box.set_border_width(2)
   35	        window.add(box)
   36	
   37	        # create a tooltips object
   38	        self.tooltips = gtk.Tooltips()
   39	
   40	        # Pack and show all our widgets
   41	        box.show()
   42	
   43	        button = create_arrow_button(gtk.ARROW_UP, gtk.SHADOW_IN)
   44	        box.pack_start(button, False, False, 3)
   45	        self.tooltips.set_tip(button, "SHADOW_IN")
   46	
   47	        button = create_arrow_button(gtk.ARROW_DOWN, gtk.SHADOW_OUT)
   48	        box.pack_start(button, False, False, 3)
   49	        self.tooltips.set_tip(button, "SHADOW_OUT")
   50	  
   51	        button = create_arrow_button(gtk.ARROW_LEFT, gtk.SHADOW_ETCHED_IN)
   52	        box.pack_start(button, False, False, 3)
   53	        self.tooltips.set_tip(button, "SHADOW_ETCHED_IN")
   54	  
   55	        button = create_arrow_button(gtk.ARROW_RIGHT, gtk.SHADOW_ETCHED_OUT)
   56	        box.pack_start(button, False, False, 3)
   57	        self.tooltips.set_tip(button, "SHADOW_ETCHED_OUT")
   58	
   59	        window.show()
   60	
   61	def main():
   62	    gtk.main()
   63	    return 0
   64	
   65	if __name__ == "__main__":
   66	    tt = Tooltips()
   67	    main()
</pre></td></tr></table><p>There are other methods that can be used with tooltips. I will
just list them with a brief description of what they do.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tooltips.enable()
</pre></td></tr></table><p>Enable a disabled set of tooltips.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tooltips.disable()
</pre></td></tr></table><p>Disable an enabled set of tooltips.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  tooltips.set_delay(<b class="parameter"><tt>delay</tt></b>)
</pre></td></tr></table><p>Sets how many milliseconds you have to hold your pointer over
the widget before the tooltip will pop up. The default is 500 milliseconds
(half a second).</p><p>And that's all the methods associated with tooltips. More than
you'll ever want to know :-)</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-Arrows.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-MiscellaneousWidgets.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-ProgressBars.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.2. Arrows </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 9.4. Progress Bars</td></tr></table></div></body></html>