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 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
|
.. 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
.. _wx.GridSizer:
==========================================================================================================================================
|phoenix_title| **wx.GridSizer**
==========================================================================================================================================
A grid sizer is a sizer which lays out its children in a two-dimensional table with all table fields having the same size, i.e.
the width of each field is the width of the widest child, the height of each field is the height of the tallest child.
.. seealso:: :ref:`wx.Sizer`, :ref:`Sizers Overview <sizers overview>`
|
|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>GridSizer</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.GridSizer_inheritance.png" alt="Inheritance diagram of GridSizer" 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.Sizer.html" title="wx.Sizer" alt="" coords="17,83,91,112"/> <area shape="rect" id="node3" href="wx.GridSizer.html" title="wx.GridSizer" alt="" coords="5,160,104,189"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="13,5,95,35"/> </map>
</p>
|
|sub_classes| Known Subclasses
==============================
:ref:`wx.FlexGridSizer`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.GridSizer.__init__` :ref:`wx.GridSizer` constructors.
:meth:`~wx.GridSizer.CalcMin` This method is abstract and has to be overwritten by any derived class.
:meth:`~wx.GridSizer.CalcRowsCols` CalcRowsCols() . (rows, cols)
:meth:`~wx.GridSizer.GetCols` Returns the number of columns that has been specified for the sizer.
:meth:`~wx.GridSizer.GetEffectiveColsCount` Returns the number of columns currently used by the sizer.
:meth:`~wx.GridSizer.GetEffectiveRowsCount` Returns the number of rows currently used by the sizer.
:meth:`~wx.GridSizer.GetHGap` Returns the horizontal gap (in pixels) between cells in the sizer.
:meth:`~wx.GridSizer.GetRows` Returns the number of rows that has been specified for the sizer.
:meth:`~wx.GridSizer.GetVGap` Returns the vertical gap (in pixels) between the cells in the sizer.
:meth:`~wx.GridSizer.RecalcSizes` This method is abstract and has to be overwritten by any derived class.
:meth:`~wx.GridSizer.SetCols` Sets the number of columns in the sizer.
:meth:`~wx.GridSizer.SetHGap` Sets the horizontal gap (in pixels) between cells in the sizer.
:meth:`~wx.GridSizer.SetRows` Sets the number of rows in the sizer.
:meth:`~wx.GridSizer.SetVGap` Sets the vertical gap (in pixels) between the cells in the sizer.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.GridSizer.Cols` See :meth:`~wx.GridSizer.GetCols` and :meth:`~wx.GridSizer.SetCols`
:attr:`~wx.GridSizer.EffectiveColsCount` See :meth:`~wx.GridSizer.GetEffectiveColsCount`
:attr:`~wx.GridSizer.EffectiveRowsCount` See :meth:`~wx.GridSizer.GetEffectiveRowsCount`
:attr:`~wx.GridSizer.HGap` See :meth:`~wx.GridSizer.GetHGap` and :meth:`~wx.GridSizer.SetHGap`
:attr:`~wx.GridSizer.Rows` See :meth:`~wx.GridSizer.GetRows` and :meth:`~wx.GridSizer.SetRows`
:attr:`~wx.GridSizer.VGap` See :meth:`~wx.GridSizer.GetVGap` and :meth:`~wx.GridSizer.SetVGap`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.GridSizer(Sizer)
**Possible constructors**::
GridSizer(cols, vgap, hgap)
GridSizer(cols, gap=Size(0,0))
GridSizer(rows, cols, vgap, hgap)
GridSizer(rows, cols, gap)
A grid sizer is a sizer which lays out its children in a two-
dimensional table with all table fields having the same size, i.e.
.. method:: __init__(self, *args, **kw)
:ref:`wx.GridSizer` constructors.
Usually only the number of columns in the flex grid sizer needs to be specified using `cols` argument. The number of rows will be deduced automatically depending on the number of the elements added to the sizer.
If a constructor form with `rows` parameter is used (and the value of `rows` argument is not zero, meaning "unspecified") the sizer will check that no more than ``cols*rows`` elements are added to it, i.e. that no more than the given number of `rows` is used. Adding less than maximally allowed number of items is not an error however.
Finally, it is also possible to specify the number of rows and use 0 for `cols`. In this case, the sizer will use the given fixed number of rows and as many columns as necessary.
The `gap` (or `vgap` and `hgap`, which correspond to the height and width of the :ref:`wx.Size` object) argument defines the size of the padding between the rows (its vertical component, or `vgap`) and columns (its horizontal component, or `hgap`), in pixels.
.. versionadded:: 2.9.1
(except for the four argument overload)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self, cols, vgap, hgap)`
:param `cols`:
:type `cols`: int
:param `vgap`:
:type `vgap`: int
:param `hgap`:
:type `hgap`: int
**~~~**
**__init__** `(self, cols, gap=Size(0,0))`
:param `cols`:
:type `cols`: int
:param `gap`:
:type `gap`: wx.Size
**~~~**
**__init__** `(self, rows, cols, vgap, hgap)`
:param `rows`:
:type `rows`: int
:param `cols`:
:type `cols`: int
:param `vgap`:
:type `vgap`: int
:param `hgap`:
:type `hgap`: int
**~~~**
**__init__** `(self, rows, cols, gap)`
:param `rows`:
:type `rows`: int
:param `cols`:
:type `cols`: int
:param `gap`:
:type `gap`: wx.Size
**~~~**
.. method:: CalcMin(self)
This method is abstract and has to be overwritten by any derived class.
Here, the sizer will do the actual calculation of its children's minimal sizes.
:rtype: :ref:`wx.Size`
.. method:: CalcRowsCols(self)
Calculates how many rows and columns will be in the sizer based
on the current number of items and also the rows, cols specified
in the constructor.
.. method:: GetCols(self)
Returns the number of columns that has been specified for the sizer.
Returns zero if the sizer is automatically adjusting the number of columns depending on number of its children. To get the effective number of columns or rows being currently used, see :meth:`GetEffectiveColsCount`
:rtype: `int`
.. method:: GetEffectiveColsCount(self)
Returns the number of columns currently used by the sizer.
This will depend on the number of children the sizer has if the sizer is automatically adjusting the number of columns/rows.
:rtype: `int`
.. versionadded:: 2.9.1
.. method:: GetEffectiveRowsCount(self)
Returns the number of rows currently used by the sizer.
This will depend on the number of children the sizer has if the sizer is automatically adjusting the number of columns/rows.
:rtype: `int`
.. versionadded:: 2.9.1
.. method:: GetHGap(self)
Returns the horizontal gap (in pixels) between cells in the sizer.
:rtype: `int`
.. method:: GetRows(self)
Returns the number of rows that has been specified for the sizer.
Returns zero if the sizer is automatically adjusting the number of rows depending on number of its children. To get the effective number of columns or rows being currently used, see :meth:`GetEffectiveRowsCount` .
:rtype: `int`
.. method:: GetVGap(self)
Returns the vertical gap (in pixels) between the cells in the sizer.
:rtype: `int`
.. method:: RecalcSizes(self)
This method is abstract and has to be overwritten by any derived class.
Here, the sizer will do the actual calculation of its children's positions and sizes.
.. method:: SetCols(self, cols)
Sets the number of columns in the sizer.
:param `cols`:
:type `cols`: int
.. method:: SetHGap(self, gap)
Sets the horizontal gap (in pixels) between cells in the sizer.
:param `gap`:
:type `gap`: int
.. method:: SetRows(self, rows)
Sets the number of rows in the sizer.
:param `rows`:
:type `rows`: int
.. method:: SetVGap(self, gap)
Sets the vertical gap (in pixels) between the cells in the sizer.
:param `gap`:
:type `gap`: int
.. attribute:: Cols
See :meth:`~wx.GridSizer.GetCols` and :meth:`~wx.GridSizer.SetCols`
.. attribute:: EffectiveColsCount
See :meth:`~wx.GridSizer.GetEffectiveColsCount`
.. attribute:: EffectiveRowsCount
See :meth:`~wx.GridSizer.GetEffectiveRowsCount`
.. attribute:: HGap
See :meth:`~wx.GridSizer.GetHGap` and :meth:`~wx.GridSizer.SetHGap`
.. attribute:: Rows
See :meth:`~wx.GridSizer.GetRows` and :meth:`~wx.GridSizer.SetRows`
.. attribute:: VGap
See :meth:`~wx.GridSizer.GetVGap` and :meth:`~wx.GridSizer.SetVGap`
|