summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkfixed.xml
blob: 731d4ca617e5eaa307dfafeea8a8002370edecc1 (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkfixed">
  <refnamediv>
    <refname>gtk.Fixed</refname>
    <refpurpose>a container which allows you to position widgets at fixed
coordinates</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.Fixed</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkcontainer">gtk.Container</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkfixed">gtk.Fixed</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkfixed--put">put</link></methodname>
	<methodparam><parameter
		       role="keyword">widget</parameter></methodparam>
	<methodparam><parameter role="keyword">x</parameter></methodparam>
	<methodparam><parameter role="keyword">y</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkfixed--move">move</link></methodname>
	<methodparam><parameter
		       role="keyword">widget</parameter></methodparam>
	<methodparam><parameter role="keyword">x</parameter></methodparam>
	<methodparam><parameter role="keyword">y</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkfixed--set-has-window">set_has_window</link></methodname>
	<methodparam><parameter
		       role="keyword">has_window</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkfixed--get-has-window">get_has_window</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkcontainer">gtk.Container</link>
        +-- <link linkend="class-gtkfixed">gtk.Fixed</link>
</synopsis>

  </refsect1>

  <refsect1 id="properties-gtkfixed">
    <title>gtk.Fixed Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
    <para><link linkend="properties-gtkcontainer">gtk.Container Properties</link></para>

  </refsect1>

  <refsect1 id="style-properties-gtkfixed">
    <title>gtk.Fixed Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>

  </refsect1>

  <refsect1 id="child-properties-gtkfixed">
    <title>gtk.Fixed Child Properties</title>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">

	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"x"</entry>
	      <entry>Read/Write</entry>
	<entry>The x position of the child widget.</entry>
      </row>

	<row valign="top">
	  <entry>"y"</entry>
	  <entry>Read/Write</entry>
	  <entry>The y position of the child widget.</entry>
	</row>

	</tbody>
      </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkfixed">
    <title>gtk.Fixed Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkcontainer">gtk.Container Signal Prototypes</link></para>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link> widget is a
container that can place child widgets at fixed positions and with fixed
sizes, given in pixels. <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link> performs no
automatic layout management. For most applications, you should not use this
container! It keeps you from having to learn about the other PyGTK
containers, but it results in broken applications. With <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link>, the
following things will result in truncated text, overlapping widgets, and
other display bugs:</para>

    <itemizedlist>
      <listitem>
	<para>Themes, which may change widget sizes.</para>
      </listitem>
      <listitem>
	<para>Fonts other than the one you used to write the app will of
course change the size of widgets containing text; keep in mind that users
may use a larger font because of difficulty reading the default, or they may
be using Windows or the framebuffer port of PyGTK, where different fonts are
available.</para>
      </listitem>
      <listitem>
	<para>Translation of text into other languages changes its size.
Also, display of non-English text will use a different font in many
cases.</para>
      </listitem>
    </itemizedlist>

    <para>In addition, the fixed widget can't properly be mirrored in
right-to-left languages such as Hebrew and Arabic. i.e. normally PyGTK will
flip the interface to put labels to the right of the thing they label, but
it can't do that with <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link>. So your
application will not be usable in right-to-left languages. Finally, fixed
positioning makes it kind of annoying to add and remove GUI elements, since
you have to reposition all the other elements. This is a long-term
maintenance problem for your application. If you know none of these things
are an issue for your application, and prefer the simplicity of <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link>, by all
means use the widget. But you should be aware of the tradeoffs.</para>

  </refsect1>

  <refsect1 id="constructor-gtkfixed">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.Fixed</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new fixed widget</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link>
widget</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkfixed--put">
      <title>gtk.Fixed.put</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>put</methodname>
	  <methodparam><parameter
			 role="keyword">widget</parameter></methodparam>
	  <methodparam><parameter role="keyword">x</parameter></methodparam>
	  <methodparam><parameter role="keyword">y</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">widget</parameter>&nbsp;:</term>
	  <listitem><simpara>the child widget being
added*</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">x</parameter>&nbsp;:</term>
	  <listitem><simpara>the x position of the widget
location</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">y</parameter>&nbsp;:</term>
	  <listitem><simpara>the y position of the widget
location</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>put</methodname>() method adds the child widget
specified by <parameter>widget</parameter> to the gtk.Fixed widget at the
location specified by <parameter>x</parameter> and
<parameter>y</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkfixed--move">
      <title>gtk.Fixed.move</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>move</methodname>
	  <methodparam><parameter
			 role="keyword">widget</parameter></methodparam>
	  <methodparam><parameter role="keyword">x</parameter></methodparam>
	  <methodparam><parameter role="keyword">y</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">widget</parameter>&nbsp;:</term>
	  <listitem><simpara>the child widget</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">x</parameter>&nbsp;:</term>
	  <listitem><simpara>the new x position</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">y</parameter>&nbsp;:</term>
	  <listitem><simpara>the new y position</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>move</methodname>() method moves the child
widget specified by <parameter>widget</parameter> to the location specified
specified by <parameter>x</parameter> and <parameter>y</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkfixed--set-has-window">
      <title>gtk.Fixed.set_has_window</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_has_window</methodname>
	  <methodparam><parameter
			 role="keyword">has_window</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">has_window</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal> a separate window
should be created</simpara></listitem>
	</varlistentry>
      </variablelist>
      
      <para>The <methodname>set_has_window</methodname>() method specifies
whether a <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link> widget is
created with a separate <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link>
according to the value of <parameter>has_window</parameter>. If
<parameter>has_window</parameter> is <literal>True</literal> the fixed
widget will be created with its own separate window. By default, the setting
is <literal>False</literal> and the fixed will be created with no separate
<link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link>. This
method must be called while the <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link> is not
realized, for instance, immediately after the window is created.</para>

    </refsect2>

    <refsect2 id="method-gtkfixed--get-has-window">
      <title>gtk.Fixed.get_has_window</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_has_window</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> if the fixed widget has
its own window.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_has_window</methodname>() method returns
<literal>True</literal> if the <link
linkend="class-gtkfixed"><classname>gtk.Fixed</classname></link> widget  has
it's own <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link>. See
the <link
linkend="method-gtkfixed--set-has-window"><methodname>set_has_window</methodname>()</link> 
method.</para>

    </refsect2>

  </refsect1>

</refentry>