.. 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.GridBagSizer: ========================================================================================================================================== |phoenix_title| **wx.GridBagSizer** ========================================================================================================================================== A :ref:`wx.Sizer` that can lay out items in a virtual grid like a :ref:`wx.FlexGridSizer` but in this case explicit positioning of the items is allowed using :ref:`wx.GBPosition`, and items can optionally span more than one row and/or column using :ref:`wx.GBSpan`. | |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>GridBagSizer</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.GridBagSizer_inheritance.png" alt="Inheritance diagram of GridBagSizer" usemap="#dummy" class="inheritance"/></center> <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script> <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.GridBagSizer.html" title="A wx.Sizer that can lay out items in a virtual grid like a wx.FlexGridSizer but in this case explicit positioning of the items is allowed using wx.GBPosition, and items can optionally span more than one row and/or column using wx.GBSpan." alt="" coords="6,315,138,344"/> <area shape="rect" id="node2" href="wx.FlexGridSizer.html" title="A flex grid sizer is a sizer which lays out its children in a two-dimensional table with all table fields in one row having the same height and all fields in one column having the same width, but all rows or all columns are not necessarily the same height or width as in the wx.GridSizer." alt="" coords="5,237,139,267"/> <area shape="rect" id="node3" href="wx.GridSizer.html" title="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." alt="" coords="19,160,125,189"/> <area shape="rect" id="node4" href="wx.Sizer.html" title="wx.Sizer is the abstract base class used for laying out subwindows in a window." alt="" coords="33,83,111,112"/> <area shape="rect" id="node5" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="28,5,116,35"/> </map> </p> </div> | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.GridBagSizer.__init__` Constructor, with optional parameters to specify the gap between the rows and columns. :meth:`~wx.GridBagSizer.Add` Adds the given item to the given position. :meth:`~wx.GridBagSizer.CalcMin` Called when the managed size of the sizer is needed or when layout needs done. :meth:`~wx.GridBagSizer.CheckForIntersection` Look at all items and see if any intersect (or would overlap) the given item. :meth:`~wx.GridBagSizer.FindItem` Find the sizer item for the given window or subsizer, returns ``None`` if not found. :meth:`~wx.GridBagSizer.FindItemAtPoint` Return the sizer item located at the point given in pt, or ``None`` if there is no item at that point. :meth:`~wx.GridBagSizer.FindItemAtPosition` Return the sizer item for the given grid cell, or ``None`` if there is no item at that position. :meth:`~wx.GridBagSizer.FindItemWithData` Return the sizer item that has a matching user data (it only compares pointer values) or ``None`` if not found. :meth:`~wx.GridBagSizer.GetCellSize` Get the size of the specified cell, including hgap and vgap. :meth:`~wx.GridBagSizer.GetEmptyCellSize` Get the size used for cells in the grid with no item. :meth:`~wx.GridBagSizer.GetItemPosition` Get the grid position of the specified item. :meth:`~wx.GridBagSizer.GetItemSpan` Get the row/col spanning of the specified item. :meth:`~wx.GridBagSizer.RecalcSizes` Called when the managed size of the sizer is needed or when layout needs done. :meth:`~wx.GridBagSizer.SetEmptyCellSize` Set the size used for cells in the grid with no item. :meth:`~wx.GridBagSizer.SetItemPosition` Set the grid position of the specified item. :meth:`~wx.GridBagSizer.SetItemSpan` Set the row/col spanning of the specified item. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.GridBagSizer.EmptyCellSize` See :meth:`~wx.GridBagSizer.GetEmptyCellSize` and :meth:`~wx.GridBagSizer.SetEmptyCellSize` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.GridBagSizer(FlexGridSizer) **Possible constructors**:: GridBagSizer(vgap=0, hgap=0) A Sizer that can lay out items in a virtual grid like a FlexGridSizer but in this case explicit positioning of the items is allowed using GBPosition, and items can optionally span more than one row and/or column using GBSpan. .. method:: __init__(self, vgap=0, hgap=0) Constructor, with optional parameters to specify the gap between the rows and columns. :param `vgap`: :type `vgap`: int :param `hgap`: :type `hgap`: int .. method:: Add(self, *args, **kw) |overload| Overloaded Implementations: :html:`<hr class="overloadsep" /><br />` **Add** `(self, window, pos, span=DefaultSpan, flag=0, border=0, userData=None)` Adds the given item to the given position. :param `window`: :type `window`: wx.Window :param `pos`: :type `pos`: wx.GBPosition :param `span`: :type `span`: wx.GBSpan :param `flag`: :type `flag`: int :param `border`: :type `border`: int :param `userData`: :type `userData`: PyUserData :rtype: :ref:`wx.SizerItem` :returns: A valid pointer if the item was successfully placed at the given position, or ``None`` if something was already there. :html:`<hr class="overloadsep" /><br />` **Add** `(self, sizer, pos, span=DefaultSpan, flag=0, border=0, userData=None)` Adds the given item to the given position. :param `sizer`: :type `sizer`: wx.Sizer :param `pos`: :type `pos`: wx.GBPosition :param `span`: :type `span`: wx.GBSpan :param `flag`: :type `flag`: int :param `border`: :type `border`: int :param `userData`: :type `userData`: PyUserData :rtype: :ref:`wx.SizerItem` :returns: A valid pointer if the item was successfully placed at the given position, or ``None`` if something was already there. :html:`<hr class="overloadsep" /><br />` **Add** `(self, item)` Adds the given item to the given position. :param `item`: :type `item`: wx.GBSizerItem :rtype: :ref:`wx.SizerItem` :returns: A valid pointer if the item was successfully placed at the given position, or ``None`` if something was already there. :html:`<hr class="overloadsep" /><br />` **Add** `(self, width, height, pos, span=DefaultSpan, flag=0, border=0, userData=None)` Adds a spacer to the given position. `width` and `height` specify the dimension of the spacer to be added. :param `width`: :type `width`: int :param `height`: :type `height`: int :param `pos`: :type `pos`: wx.GBPosition :param `span`: :type `span`: wx.GBSpan :param `flag`: :type `flag`: int :param `border`: :type `border`: int :param `userData`: :type `userData`: PyUserData :rtype: :ref:`wx.SizerItem` :returns: A valid pointer if the spacer was successfully placed at the given position, or ``None`` if something was already there. :html:`<hr class="overloadsep" /><br />` **Add** `(self, size, pos, span=DefaultSpan, flag=0, border=0, /Transfer/=None)` Add a spacer using a :class:`Size` object. :rtype: :ref:`wx.SizerItem` :html:`<hr class="overloadsep" /><br />` .. method:: CalcMin(self) Called when the managed size of the sizer is needed or when layout needs done. :rtype: :ref:`wx.Size` .. method:: CheckForIntersection(self, *args, **kw) Look at all items and see if any intersect (or would overlap) the given item. Returns ``True`` if so, ``False`` if there would be no overlap. If an `excludeItem` is given then it will not be checked for intersection, for example it may be the item we are checking the position of. |overload| Overloaded Implementations: :html:`<hr class="overloadsep" /><br />` **CheckForIntersection** `(self, item, excludeItem=None)` :param `item`: :type `item`: wx.GBSizerItem :param `excludeItem`: :type `excludeItem`: wx.GBSizerItem :rtype: `bool` :html:`<hr class="overloadsep" /><br />` **CheckForIntersection** `(self, pos, span, excludeItem=None)` :param `pos`: :type `pos`: wx.GBPosition :param `span`: :type `span`: wx.GBSpan :param `excludeItem`: :type `excludeItem`: wx.GBSizerItem :rtype: `bool` :html:`<hr class="overloadsep" /><br />` .. method:: FindItem(self, *args, **kw) Find the sizer item for the given window or subsizer, returns ``None`` if not found. (non-recursive) |overload| Overloaded Implementations: :html:`<hr class="overloadsep" /><br />` **FindItem** `(self, window)` :param `window`: :type `window`: wx.Window :rtype: :ref:`wx.GBSizerItem` :html:`<hr class="overloadsep" /><br />` **FindItem** `(self, sizer)` :param `sizer`: :type `sizer`: wx.Sizer :rtype: :ref:`wx.GBSizerItem` :html:`<hr class="overloadsep" /><br />` .. method:: FindItemAtPoint(self, pt) Return the sizer item located at the point given in pt, or ``None`` if there is no item at that point. The (x,y) coordinates in `pt` correspond to the client coordinates of the window using the sizer for layout. (non-recursive) :param `pt`: :type `pt`: wx.Point :rtype: :ref:`wx.GBSizerItem` .. method:: FindItemAtPosition(self, pos) Return the sizer item for the given grid cell, or ``None`` if there is no item at that position. (non-recursive) :param `pos`: :type `pos`: wx.GBPosition :rtype: :ref:`wx.GBSizerItem` .. method:: FindItemWithData(self, userData) Return the sizer item that has a matching user data (it only compares pointer values) or ``None`` if not found. (non-recursive) :param `userData`: :type `userData`: wx.Object :rtype: :ref:`wx.GBSizerItem` .. method:: GetCellSize(self, row, col) Get the size of the specified cell, including hgap and vgap. Only valid after window layout has been performed. :param `row`: :type `row`: int :param `col`: :type `col`: int :rtype: :ref:`wx.Size` .. method:: GetEmptyCellSize(self) Get the size used for cells in the grid with no item. :rtype: :ref:`wx.Size` .. method:: GetItemPosition(self, *args, **kw) Get the grid position of the specified item. |overload| Overloaded Implementations: :html:`<hr class="overloadsep" /><br />` **GetItemPosition** `(self, window)` :param `window`: :type `window`: wx.Window :rtype: :ref:`wx.GBPosition` :html:`<hr class="overloadsep" /><br />` **GetItemPosition** `(self, sizer)` :param `sizer`: :type `sizer`: wx.Sizer :rtype: :ref:`wx.GBPosition` :html:`<hr class="overloadsep" /><br />` **GetItemPosition** `(self, index)` :param `index`: :type `index`: int :rtype: :ref:`wx.GBPosition` :html:`<hr class="overloadsep" /><br />` .. method:: GetItemSpan(self, *args, **kw) Get the row/col spanning of the specified item. |overload| Overloaded Implementations: :html:`<hr class="overloadsep" /><br />` **GetItemSpan** `(self, window)` :param `window`: :type `window`: wx.Window :rtype: :ref:`wx.GBSpan` :html:`<hr class="overloadsep" /><br />` **GetItemSpan** `(self, sizer)` :param `sizer`: :type `sizer`: wx.Sizer :rtype: :ref:`wx.GBSpan` :html:`<hr class="overloadsep" /><br />` **GetItemSpan** `(self, index)` :param `index`: :type `index`: int :rtype: :ref:`wx.GBSpan` :html:`<hr class="overloadsep" /><br />` .. method:: RecalcSizes(self) Called when the managed size of the sizer is needed or when layout needs done. .. method:: SetEmptyCellSize(self, sz) Set the size used for cells in the grid with no item. :param `sz`: :type `sz`: wx.Size .. method:: SetItemPosition(self, *args, **kw) Set the grid position of the specified item. Returns ``True`` on success. If the move is not allowed (because an item is already there) then ``False`` is returned. |overload| Overloaded Implementations: :html:`<hr class="overloadsep" /><br />` **SetItemPosition** `(self, window, pos)` :param `window`: :type `window`: wx.Window :param `pos`: :type `pos`: wx.GBPosition :rtype: `bool` :html:`<hr class="overloadsep" /><br />` **SetItemPosition** `(self, sizer, pos)` :param `sizer`: :type `sizer`: wx.Sizer :param `pos`: :type `pos`: wx.GBPosition :rtype: `bool` :html:`<hr class="overloadsep" /><br />` **SetItemPosition** `(self, index, pos)` :param `index`: :type `index`: int :param `pos`: :type `pos`: wx.GBPosition :rtype: `bool` :html:`<hr class="overloadsep" /><br />` .. method:: SetItemSpan(self, *args, **kw) Set the row/col spanning of the specified item. Returns ``True`` on success. If the move is not allowed (because an item is already there) then ``False`` is returned. |overload| Overloaded Implementations: :html:`<hr class="overloadsep" /><br />` **SetItemSpan** `(self, window, span)` :param `window`: :type `window`: wx.Window :param `span`: :type `span`: wx.GBSpan :rtype: `bool` :html:`<hr class="overloadsep" /><br />` **SetItemSpan** `(self, sizer, span)` :param `sizer`: :type `sizer`: wx.Sizer :param `span`: :type `span`: wx.GBSpan :rtype: `bool` :html:`<hr class="overloadsep" /><br />` **SetItemSpan** `(self, index, span)` :param `index`: :type `index`: int :param `span`: :type `span`: wx.GBSpan :rtype: `bool` :html:`<hr class="overloadsep" /><br />` .. attribute:: EmptyCellSize See :meth:`~wx.GridBagSizer.GetEmptyCellSize` and :meth:`~wx.GridBagSizer.SetEmptyCellSize`