.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 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
Inheritance diagram for class GridBagSizer:
| |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.RepositionChildren` 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:`

` **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:`

` **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:`

` **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:`

` **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:`

` **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:`

` .. 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:`

` **CheckForIntersection** `(self, item, excludeItem=None)` :param `item`: :type `item`: wx.GBSizerItem :param `excludeItem`: :type `excludeItem`: wx.GBSizerItem :rtype: `bool` :html:`

` **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:`

` .. 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:`

` **FindItem** `(self, window)` :param `window`: :type `window`: wx.Window :rtype: :ref:`wx.GBSizerItem` :html:`

` **FindItem** `(self, sizer)` :param `sizer`: :type `sizer`: wx.Sizer :rtype: :ref:`wx.GBSizerItem` :html:`

` .. 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:`

` **GetItemPosition** `(self, window)` :param `window`: :type `window`: wx.Window :rtype: :ref:`wx.GBPosition` :html:`

` **GetItemPosition** `(self, sizer)` :param `sizer`: :type `sizer`: wx.Sizer :rtype: :ref:`wx.GBPosition` :html:`

` **GetItemPosition** `(self, index)` :param `index`: :type `index`: int :rtype: :ref:`wx.GBPosition` :html:`

` .. method:: GetItemSpan(self, *args, **kw) Get the row/col spanning of the specified item. |overload| Overloaded Implementations: :html:`

` **GetItemSpan** `(self, window)` :param `window`: :type `window`: wx.Window :rtype: :ref:`wx.GBSpan` :html:`

` **GetItemSpan** `(self, sizer)` :param `sizer`: :type `sizer`: wx.Sizer :rtype: :ref:`wx.GBSpan` :html:`

` **GetItemSpan** `(self, index)` :param `index`: :type `index`: int :rtype: :ref:`wx.GBSpan` :html:`

` .. method:: RepositionChildren(self, minSize) Called when the managed size of the sizer is needed or when layout needs done. :param `minSize`: :type `minSize`: wx.Size .. 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:`

` **SetItemPosition** `(self, window, pos)` :param `window`: :type `window`: wx.Window :param `pos`: :type `pos`: wx.GBPosition :rtype: `bool` :html:`

` **SetItemPosition** `(self, sizer, pos)` :param `sizer`: :type `sizer`: wx.Sizer :param `pos`: :type `pos`: wx.GBPosition :rtype: `bool` :html:`

` **SetItemPosition** `(self, index, pos)` :param `index`: :type `index`: int :param `pos`: :type `pos`: wx.GBPosition :rtype: `bool` :html:`

` .. 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:`

` **SetItemSpan** `(self, window, span)` :param `window`: :type `window`: wx.Window :param `span`: :type `span`: wx.GBSpan :rtype: `bool` :html:`

` **SetItemSpan** `(self, sizer, span)` :param `sizer`: :type `sizer`: wx.Sizer :param `span`: :type `span`: wx.GBSpan :rtype: `bool` :html:`

` **SetItemSpan** `(self, index, span)` :param `index`: :type `index`: int :param `span`: :type `span`: wx.GBSpan :rtype: `bool` :html:`

` .. attribute:: EmptyCellSize See :meth:`~wx.GridBagSizer.GetEmptyCellSize` and :meth:`~wx.GridBagSizer.SetEmptyCellSize`