/usr/share/doc/python-gtk2-tutorial/html/sec-Fixed.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 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>10.3. Fixed Container</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-ContainerWidgets.html" title="Chapter 10. Container Widgets"><link rel="previous" href="sec-Alignment.html" title="10.2. The Alignment widget"><link rel="next" href="sec-Layout.html" title="10.4. Layout Container"></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">10.3. Fixed Container</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-Alignment.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Container Widgets</th><td width="20%" align="right"> <a accesskey="n" href="sec-Layout.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-Fixed"></a>10.3. Fixed Container</h2></div></div><div></div></div><p>The <tt class="classname">Fixed</tt> container allows you to place
widgets at a fixed position within it's window, relative to it's upper left
hand corner. The position of the widgets can be changed dynamically.</p><p>There are only three calls associated with the fixed
widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
fixed = gtk.Fixed()
fixed.put(<b class="parameter"><tt>widget</tt></b>, <b class="parameter"><tt>x</tt></b>, <b class="parameter"><tt>y</tt></b>)
fixed.move(<b class="parameter"><tt>widget</tt></b>, <b class="parameter"><tt>x</tt></b>, <b class="parameter"><tt>y</tt></b>)
</pre></td></tr></table><p>The function <tt class="function">gtk.Fixed</tt>() allows you to
create a new <tt class="classname">Fixed</tt> container.</p><p>The <tt class="methodname">put</tt>() method places widget in the
container fixed at the position specified by <i class="parameter"><tt>x</tt></i> and
<i class="parameter"><tt>y</tt></i>.</p><p>The <tt class="methodname">move</tt>() method allows the specified
widget to be moved to a new position.</p><p>The <a href="examples/fixed.py" target="_top"><span><b class="command">fixed.py</b></span></a> example
illustrates how to use the <tt class="classname">Fixed</tt> container.
<a href="sec-Fixed.html#fixedfig" title="Figure 10.2. Fixed Example">Figure 10.2, “Fixed Example”</a> shows the result:</p><div class="figure"><a name="fixedfig"></a><p class="title"><b>Figure 10.2. Fixed Example</b></p><div class="mediaobject" align="center"><img src="figures/fixed.png" align="middle" alt="Fixed Example"></div></div><p>The source code for <a href="examples/fixed.py" target="_top"><span><b class="command">fixed.py</b></span></a>:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
1 #!/usr/bin/env python
2
3 # example fixed.py
4
5 import pygtk
6 pygtk.require('2.0')
7 import gtk
8
9 class FixedExample:
10 # This callback method moves the button to a new position
11 # in the Fixed container.
12 def move_button(self, widget):
13 self.x = (self.x+30)%300
14 self.y = (self.y+50)%300
15 self.fixed.move(widget, self.x, self.y)
16
17 def __init__(self):
18 self.x = 50
19 self.y = 50
20
21 # Create a new window
22 window = gtk.Window(gtk.WINDOW_TOPLEVEL)
23 window.set_title("Fixed Container")
24
25 # Here we connect the "destroy" event to a signal handler
26 window.connect("destroy", lambda w: gtk.main_quit())
27
28 # Sets the border width of the window.
29 window.set_border_width(10)
30
31 # Create a Fixed Container
32 self.fixed = gtk.Fixed()
33 window.add(self.fixed)
34 self.fixed.show()
35
36 for i in range(1, 4):
37 # Creates a new button with the label "Press me"
38 button = gtk.Button("Press me")
39
40 # When the button receives the "clicked" signal, it will call the
41 # method move_button().
42 button.connect("clicked", self.move_button)
43
44 # This packs the button into the fixed containers window.
45 self.fixed.put(button, i*50, i*50)
46
47 # The final step is to display this newly created widget.
48 button.show()
49
50 # Display the window
51 window.show()
52
53 def main():
54 # Enter the event loop
55 gtk.main()
56 return 0
57
58 if __name__ == "__main__":
59 FixedExample()
60 main()
</pre></td></tr></table></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-Alignment.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch-ContainerWidgets.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-Layout.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">10.2. The Alignment widget </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 10.4. Layout Container</td></tr></table></div></body></html>
|