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
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.layoutf
.. highlight:: python
.. _wx.lib.layoutf.Layoutf:
==========================================================================================================================================
|phoenix_title| **wx.lib.layoutf.Layoutf**
==========================================================================================================================================
The class Layoutf(wxLayoutConstraints) presents a simplification
of the wxLayoutConstraints syntax. The name Layoutf is choosen
because of the similarity with C's printf function.
Quick Example::
lc = Layoutf('t=t#1;l=r10#2;r!100;h%h50#1', (self, self.panel))
is equivalent to::
lc = wx.LayoutContraints()
lc.top.SameAs(self, wx.Top)
lc.left.SameAs(self.panel, wx.Right, 10)
lc.right.Absolute(100)
lc.height.PercentOf(self, wx.Height, 50)
Usage:
You can give a constraint string to the Layoutf constructor,
or use the 'pack' method. The following are equivalent::
lc = Layoutf('t=t#1;l=r#2;r!100;h%h50#1', (self, self.panel))
and::
lc = Layoutf()
lc.pack('t=t#1;l=r#2;r!100;h%h50#1', (self, self.panel))
Besides 'pack' there's also 'debug_pack' which does not set
constraints, but prints traditional wxLayoutConstraint calls to
stdout.
The calls to the Layoutf constructor and pack methods have
the following argument list:
`(constraint_string, objects_tuple)`
Constraint String syntax:
Constraint directives are separated by semi-colons. You
generally (always?) need four directives to completely describe a
subwindow's location.
A single directive has either of the following forms:
1. <own attribute><compare operation>[numerical argument]
for example ``r!100`` -> lc.right.Absolute(100) )
and ``w*`` -> lc.width.AsIs()
2. <own attribute><compare operation>[numerical argument]
#<compare object nr.>
for example ``t_10#2`` -> lc.top.Below(<second obj>, 10)
3. <own attribute><compare operation><compare attribute>
[numerical argument]#<compare object nr.>
for example ``w%h50#2`` -> lc.width.PercentOf(<second obj>, wx.Height, 50) and ``t=b#1`` -> lc.top.SameAs(<first obj>, wx.Bottom)
Which one you need is defined by the <compare operation>
type. The following take type 1 (no object to compare with):
* '!': 'Absolute', '?': 'Unconstrained', '*': 'AsIs'
These take type 2 (need to be compared with another object)
* '<': 'LeftOf', '>': 'RightOf', '^': 'Above', '_': 'Below'
These take type 3 (need to be compared to another object
attribute)
* '=': 'SameAs', '%': 'PercentOf'
For all types, the <own attribute> letter can be any of
* 't': 'top', 'l': 'left', 'b': 'bottom',
* 'r': 'right', 'h': 'height', 'w': 'width',
* 'x': 'centreX', 'y': 'centreY'
If the operation takes an (optional) numerical argument, place it
in [numerical argument]. For type 3 directives, the <compare
attribute> letter can be any of
* 't': 'wxTop', 'l': 'wxLeft', 'b': 'wx.Bottom'
* 'r': 'wxRight', 'h': 'wxHeight', 'w': 'wx.Width',
* 'x': 'wxCentreX', 'y': 'wx.CentreY'
Note that these are the same letters as used for <own attribute>,
so you'll only need to remember one set. Finally, the object
whose attribute is refered to, is specified by #<compare object
nr>, where <compare object nr> is the 1-based (stupid, I know,
but I've gotten used to it) index of the object in the
objects_tuple argument.
Bugs:
Not entirely happy about the logic in the order of arguments
after the <compare operation> character.
Not all wxLayoutConstraint methods are included in the
syntax. However, the type 3 directives are generally the most
used. Further excuse: wxWindows layout constraints are at the
time of this writing not documented.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>Layoutf</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.layoutf.Layoutf_inheritance.png" alt="Inheritance diagram of Layoutf" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.layoutf.Layoutf.html" title="wx.lib.layoutf.Layoutf" alt="" coords="7,160,160,189"/> <area shape="rect" id="node2" href="wx.LayoutConstraints.html" title="wx.LayoutConstraints" alt="" coords="5,83,163,112"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="43,5,124,35"/> </map>
</p>
|
|super_classes| Known Superclasses
==================================
:class:`wx.LayoutConstraints`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.layoutf.Layoutf.__init__`
:meth:`~wx.lib.layoutf.Layoutf.debug_pack`
:meth:`~wx.lib.layoutf.Layoutf.pack`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: Layoutf(wx.LayoutConstraints)
The class Layoutf(wxLayoutConstraints) presents a simplification
of the wxLayoutConstraints syntax. The name Layoutf is choosen
because of the similarity with C's printf function.
Quick Example::
lc = Layoutf('t=t#1;l=r10#2;r!100;h%h50#1', (self, self.panel))
is equivalent to::
lc = wx.LayoutContraints()
lc.top.SameAs(self, wx.Top)
lc.left.SameAs(self.panel, wx.Right, 10)
lc.right.Absolute(100)
lc.height.PercentOf(self, wx.Height, 50)
Usage:
You can give a constraint string to the Layoutf constructor,
or use the 'pack' method. The following are equivalent::
lc = Layoutf('t=t#1;l=r#2;r!100;h%h50#1', (self, self.panel))
and::
lc = Layoutf()
lc.pack('t=t#1;l=r#2;r!100;h%h50#1', (self, self.panel))
Besides 'pack' there's also 'debug_pack' which does not set
constraints, but prints traditional wxLayoutConstraint calls to
stdout.
The calls to the Layoutf constructor and pack methods have
the following argument list:
`(constraint_string, objects_tuple)`
Constraint String syntax:
Constraint directives are separated by semi-colons. You
generally (always?) need four directives to completely describe a
subwindow's location.
A single directive has either of the following forms:
1. <own attribute><compare operation>[numerical argument]
for example ``r!100`` -> lc.right.Absolute(100) )
and ``w*`` -> lc.width.AsIs()
2. <own attribute><compare operation>[numerical argument]
#<compare object nr.>
for example ``t_10#2`` -> lc.top.Below(<second obj>, 10)
3. <own attribute><compare operation><compare attribute>
[numerical argument]#<compare object nr.>
for example ``w%h50#2`` -> lc.width.PercentOf(<second obj>, wx.Height, 50) and ``t=b#1`` -> lc.top.SameAs(<first obj>, wx.Bottom)
Which one you need is defined by the <compare operation>
type. The following take type 1 (no object to compare with):
* '!': 'Absolute', '?': 'Unconstrained', '*': 'AsIs'
These take type 2 (need to be compared with another object)
* '<': 'LeftOf', '>': 'RightOf', '^': 'Above', '_': 'Below'
These take type 3 (need to be compared to another object
attribute)
* '=': 'SameAs', '%': 'PercentOf'
For all types, the <own attribute> letter can be any of
* 't': 'top', 'l': 'left', 'b': 'bottom',
* 'r': 'right', 'h': 'height', 'w': 'width',
* 'x': 'centreX', 'y': 'centreY'
If the operation takes an (optional) numerical argument, place it
in [numerical argument]. For type 3 directives, the <compare
attribute> letter can be any of
* 't': 'wxTop', 'l': 'wxLeft', 'b': 'wx.Bottom'
* 'r': 'wxRight', 'h': 'wxHeight', 'w': 'wx.Width',
* 'x': 'wxCentreX', 'y': 'wx.CentreY'
Note that these are the same letters as used for <own attribute>,
so you'll only need to remember one set. Finally, the object
whose attribute is refered to, is specified by #<compare object
nr>, where <compare object nr> is the 1-based (stupid, I know,
but I've gotten used to it) index of the object in the
objects_tuple argument.
Bugs:
Not entirely happy about the logic in the order of arguments
after the <compare operation> character.
Not all wxLayoutConstraint methods are included in the
syntax. However, the type 3 directives are generally the most
used. Further excuse: wxWindows layout constraints are at the
time of this writing not documented.
.. method:: __init__(self,pstr=None,winlist=None)
.. method:: debug_pack(self, pstr, winlist)
.. method:: pack(self, pstr, winlist)
|