This file is indexed.

/usr/share/doc/python-gtk2-tutorial/html/sec-PackingUsingTables.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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.4. Packing Using Tables</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-PackingDemonstrationProgram.html" title="4.3. Packing Demonstration Program"><link rel="next" href="sec-TablePackingExample.html" title="4.5. Table Packing Example"></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.4. Packing Using Tables</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-PackingDemonstrationProgram.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Packing Widgets</th><td width="20%" align="right"> <a accesskey="n" href="sec-TablePackingExample.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-PackingUsingTables"></a>4.4. Packing Using Tables</h2></div></div><div></div></div><p>Let's take a look at another way of packing - Tables. These can
be extremely useful in certain situations.</p><p>Using tables, we create a grid that we can place widgets in. The
widgets may take up as many spaces as we specify.</p><p>The first thing to look at, of course, is the
<tt class="function">gtk.Table</tt>() function:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table = gtk.Table(<b class="parameter"><tt>rows</tt></b>=1, <b class="parameter"><tt>columns</tt></b>=1, <b class="parameter"><tt>homogeneous</tt></b>=False)
</pre></td></tr></table><p>The first argument is the number of rows to make in the table,
while the second, obviously, is the number of columns.</p><p>The <i class="parameter"><tt>homogeneous</tt></i> argument has to do with
how the table's boxes are sized. If <i class="parameter"><tt>homogeneous</tt></i> is
<tt class="literal">True</tt>, the table boxes are resized to the size of the
largest widget in the table. If <i class="parameter"><tt>homogeneous</tt></i> is
<tt class="literal">False</tt>, the size of a table boxes is dictated by the
tallest widget in its same row, and the widest widget in its column.</p><p>The rows and columns are laid out from 0 to n, where n was the number
specified in the call to <tt class="function">gtk.Table</tt>(). So, if you
specify rows = 2 and columns = 2, the layout would look something like
this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
   0          1          2
  0+----------+----------+
   |          |          |
  1+----------+----------+
   |          |          |
  2+----------+----------+
</pre></td></tr></table><p>Note that the coordinate system starts in the upper left hand
corner. To place a widget into a box, use the following method:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table.attach(<b class="parameter"><tt>child</tt></b>, <b class="parameter"><tt>left_attach</tt></b>, <b class="parameter"><tt>right_attach</tt></b>, <b class="parameter"><tt>top_attach</tt></b>, <b class="parameter"><tt>bottom_attach</tt></b>,
               <b class="parameter"><tt>xoptions</tt></b>=EXPAND|FILL, <b class="parameter"><tt>yoptions</tt></b>=EXPAND|FILL, <b class="parameter"><tt>xpadding</tt></b>=0, <b class="parameter"><tt>ypadding</tt></b>=0)
</pre></td></tr></table><p>The table instance is the table you created with
<tt class="function">gtk.Table</tt>(). The first parameter ("child") is the
widget you wish to place in the table.</p><p>The <i class="parameter"><tt>left_attach</tt></i>,
<i class="parameter"><tt>right_attach</tt></i>, <i class="parameter"><tt>top_attach</tt></i> and
<i class="parameter"><tt>bottom_attach</tt></i> arguments specify where to place the
widget, and how many boxes to use. If you want a button in the lower right
table entry of our 2x2 table, and want it to fill that entry ONLY,
<i class="parameter"><tt>left_attach</tt></i> would be = 1,
<i class="parameter"><tt>right_attach</tt></i> = 2, <i class="parameter"><tt>top_attach</tt></i> =
1, <i class="parameter"><tt>bottom_attach</tt></i> = 2.</p><p>Now, if you wanted a widget to take up the whole top row of our
2x2 table, you'd use <i class="parameter"><tt>left_attach</tt></i> = 0,
<i class="parameter"><tt>right_attach</tt></i> = 2, <i class="parameter"><tt>top_attach</tt></i> =
0, <i class="parameter"><tt>bottom_attach</tt></i> = 1.</p><p>The <i class="parameter"><tt>xoptions</tt></i> and
<i class="parameter"><tt>yoptions</tt></i> are used to specify packing options and may
be bitwise OR'ed together to allow multiple options.</p><p>These options are:</p><div class="informaltable"><table width="100%" border="1"><colgroup><col><col></colgroup><tbody><tr><td><tt class="literal">FILL</tt></td><td>If the table cell is larger than the widget, and
<tt class="literal">FILL</tt> is specified, the widget will expand to use all the
room available in the cell.</td></tr><tr><td><tt class="literal">SHRINK</tt></td><td>If the table widget was allocated less space then was
requested (usually by the user resizing the window), then the widgets would
normally just be pushed off the bottom of the window and disappear. If
<tt class="literal">SHRINK</tt> is specified, the widgets will shrink with the
table.</td></tr><tr><td><tt class="literal">EXPAND</tt></td><td>This will cause the table cell to expand to use up any
remaining space allocated to the table.</td></tr></tbody></table></div><p>Padding is just like in boxes, creating a clear area around the
widget specified in pixels.</p><p>We also have <tt class="methodname">set_row_spacing</tt>() and
<tt class="methodname">set_col_spacing</tt>() methods. These add spacing
between the rows at the specified row or column.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table.set_row_spacing(<b class="parameter"><tt>row</tt></b>, <b class="parameter"><tt>spacing</tt></b>)
</pre></td></tr></table><p>and</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table.set_col_spacing(<b class="parameter"><tt>column</tt></b>, <b class="parameter"><tt>spacing</tt></b>)
</pre></td></tr></table><p>Note that for columns, the space goes to the right of the
column, and for rows, the space goes below the row.</p><p>You can also set a consistent spacing of all rows and/or columns
with:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table.set_row_spacings(<b class="parameter"><tt>spacing</tt></b>)
</pre></td></tr></table><p>and,</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  table.set_col_spacings(<b class="parameter"><tt>spacing</tt></b>)
</pre></td></tr></table><p>Note that with these calls, the last row and last column do not
get any spacing.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-PackingDemonstrationProgram.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="sec-TablePackingExample.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.3. Packing Demonstration Program </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.5. Table Packing Example</td></tr></table></div></body></html>