This file is indexed.

/usr/share/doc/python-gtk2-tutorial/html/sec-TablePackingExample.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
100
101
102
103
104
105
106
107
108
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.5. Table Packing Example</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-PackingWidgets.html" title="Chapter 4. Packing Widgets"><link rel="previous" href="sec-PackingUsingTables.html" title="4.4. Packing Using Tables"><link rel="next" href="ch-WidgetOverview.html" title="Chapter 5. Widget Overview"></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">4.5. Table Packing Example</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-PackingUsingTables.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Packing Widgets</th><td width="20%" align="right"> <a accesskey="n" href="ch-WidgetOverview.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-TablePackingExample"></a>4.5. Table Packing Example</h2></div></div><div></div></div><p>The example program <a href="examples/table.py" target="_top"><span><b class="command">table.py</b></span></a> makes a window
with three buttons in a 2x2 table. The first two buttons will be placed in
the upper row. A third, quit button, is placed in the lower row, spanning
both columns. <a href="sec-TablePackingExample.html#tablefig" title="Figure 4.4. Packing using a Table">Figure 4.4, &#8220;Packing using a Table&#8221;</a> illustrates the resulting window:</p><div class="figure"><a name="tablefig"></a><p class="title"><b>Figure 4.4. Packing using a Table</b></p><div class="mediaobject" align="center"><img src="figures/table.png" align="middle" alt="Packing using a Table"></div></div><p>Here's the source code:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
    1	#!/usr/bin/env python
    2	
    3	# example table.py
    4	
    5	import pygtk
    6	pygtk.require('2.0')
    7	import gtk
    8	
    9	class Table:
   10	    # Our callback.
   11	    # The data passed to this method is printed to stdout
   12	    def callback(self, widget, data=None):
   13	        print "Hello again - %s was pressed" % data
   14	
   15	    # This callback quits the program
   16	    def delete_event(self, widget, event, data=None):
   17	        gtk.main_quit()
   18	        return False
   19	
   20	    def __init__(self):
   21	        # Create a new window
   22	        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
   23	
   24	        # Set the window title
   25	        self.window.set_title("Table")
   26	
   27	        # Set a handler for delete_event that immediately
   28	        # exits GTK.
   29	        self.window.connect("delete_event", self.delete_event)
   30	
   31	        # Sets the border width of the window.
   32	        self.window.set_border_width(20)
   33	
   34	        # Create a 2x2 table
   35	        table = gtk.Table(2, 2, True)
   36	
   37	        # Put the table in the main window
   38	        self.window.add(table)
   39	
   40	        # Create first button
   41	        button = gtk.Button("button 1")
   42	
   43	        # When the button is clicked, we call the "callback" method
   44	        # with a pointer to "button 1" as its argument
   45	        button.connect("clicked", self.callback, "button 1")
   46	
   47	
   48	        # Insert button 1 into the upper left quadrant of the table
   49	        table.attach(button, 0, 1, 0, 1)
   50	
   51	        button.show()
   52	
   53	        # Create second button
   54	
   55	        button = gtk.Button("button 2")
   56	
   57	        # When the button is clicked, we call the "callback" method
   58	        # with a pointer to "button 2" as its argument
   59	        button.connect("clicked", self.callback, "button 2")
   60	        # Insert button 2 into the upper right quadrant of the table
   61	        table.attach(button, 1, 2, 0, 1)
   62	
   63	        button.show()
   64	
   65	        # Create "Quit" button
   66	        button = gtk.Button("Quit")
   67	
   68	        # When the button is clicked, we call the main_quit function
   69	        # and the program exits
   70	        button.connect("clicked", lambda w: gtk.main_quit())
   71	
   72	        # Insert the quit button into the both lower quadrants of the table
   73	        table.attach(button, 0, 2, 1, 2)
   74	
   75	        button.show()
   76	
   77	        table.show()
   78	        self.window.show()
   79	
   80	def main():
   81	    gtk.main()
   82	    return 0       
   83	
   84	if __name__ == "__main__":
   85	    Table()
   86	    main()
</pre></td></tr></table><p>The <tt class="classname">Table</tt> class is defined in line 9-78.
Lines 12-13 define the <tt class="methodname">callback</tt>() method which is
called when two of the buttons are "clicked". The callback just prints a
message to the console indicating which button was pressed using the passed
in string data.</p><p>Lines 16-18 define the <tt class="methodname">delete_event</tt>()
method which is called when the window is slated for deletion by the window
manager.</p><p>Lines 20-78 define the <tt class="classname">Table</tt> instance
initialization method <tt class="methodname">__init__</tt>() . It creates a
window (line 22), sets the window title (line 25), connects the
<tt class="methodname">delete_event</tt>() callback to the "delete_event"
signal (line 29), and sets the border width (line 32). A
<tt class="classname">gtk.Table</tt> is created in line 35 and added to the
window in line 38.</p><p>The two upper buttons are created (lines 41 and 55), their
"clicked" signals are connected to the <tt class="methodname">callback</tt>()
method (lines 45 and 59), and attached to the table in the first row (lines
49 and 61). Lines 66-72 create the "Quit" button, connect its "clicked"
signal to the <tt class="function">main_quit</tt>() function and attach it to the
table spanning the whole second row.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-PackingUsingTables.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-PackingWidgets.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch-WidgetOverview.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.4. Packing Using Tables </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. Widget Overview</td></tr></table></div></body></html>