*************** wx.GridBagSizer *************** Inheritance diagram for `wx.GridBagSizer`: | .. inheritance-diagram:: wx.GridBagSizer | Description =========== 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 `_. Derived From ^^^^^^^^^^^^^ * `wx.FlexGridSizer `_ * `wx.GridSizer `_ * `wx.Sizer `_ * `wx.Object `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Add <#Add>`_ * `AddItem <#AddItem>`_ * `CheckForIntersection <#CheckForIntersection>`_ * `CheckForIntersectionPos <#CheckForIntersectionPos>`_ * `FindItem <#FindItem>`_ * `FindItemAtPoint <#FindItemAtPoint>`_ * `FindItemAtPosition <#FindItemAtPosition>`_ * `GetCellSize <#GetCellSize>`_ * `GetEmptyCellSize <#GetEmptyCellSize>`_ * `GetItemPosition <#GetItemPosition>`_ * `GetItemSpan <#GetItemSpan>`_ * `SetEmptyCellSize <#SetEmptyCellSize>`_ * `SetItemPosition <#SetItemPosition>`_ * `SetItemSpan <#SetItemSpan>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(vgap=0, hgap=0) Constructor, with optional parameters to specify the gap between the rows and columns. **Parameters:** * `vgap` (int) * `hgap` (int) | **Returns:** `wx.GridBagSizer `_ -------- .. method:: Add(item, pos, span=wx.DefaultSpan, flag=0, border=0, userData=None) Adds an item to the sizer at the grid cell `pos`, optionally spanning more than one row or column as specified with `span`. The remaining args behave similarly to `wx.Sizer.Add `_. Returns ``True`` if the item was successfully placed at the given cell position, ``False`` if something was already there. **Parameters:** * `pos` (`wx.GBPosition `_) * `span` (`wx.GBSpan `_) * `flag` (int) * `border` (int) * `userData` (PyObject) | **Returns:** `wx.GBSizerItem `_ -------- .. method:: AddItem(item) Add an item to the sizer using a `wx.GBSizerItem `_. Returns ``True`` if the item was successfully placed at the given cell position, ``False`` if something was already there. **Parameters:** * `item` (`wx.GBSizerItem `_) | **Returns:** `wx.GBSizerItem `_ -------- .. method:: CheckForIntersection(item, excludeItem=None) 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. **Parameters:** * `item` (`wx.GBSizerItem `_) * `excludeItem` (`wx.GBSizerItem `_) | **Returns:** `bool` -------- .. method:: CheckForIntersectionPos(pos, span, excludeItem=None) Look at all items and see if any intersect (or would overlap) the given position and span. 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. **Parameters:** * `pos` (`wx.GBPosition `_) * `span` (`wx.GBSpan `_) * `excludeItem` (`wx.GBSizerItem `_) | **Returns:** `bool` -------- .. method:: FindItem(window) Find the sizer item for the given window or subsizer, returns ``None`` if not found. **Parameters:** * `window` (`wx.Window `_) | **Returns:** `wx.GBSizerItem `_ .. note:: this function is non-recursive. -------- .. method:: FindItemAtPoint(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. **Parameters:** * `pt` (`wx.Point `_) | **Returns:** `wx.GBSizerItem `_ .. note:: this function is non-recursive. -------- .. method:: FindItemAtPosition(pos) Return the sizer item for the given grid cell, or ``None`` if there is no item at that position. **Parameters:** * `pos` (`wx.GBPosition `_) | **Returns:** `wx.GBSizerItem `_ .. note:: this function is non-recursive. -------- .. method:: GetCellSize(row, col) Get the size of the specified cell, including `hgap` and `vgap`. Only valid after a `Layout()`. **Parameters:** * `row` (int) * `col` (int) | **Returns:** `wx.Size `_ -------- .. method:: GetEmptyCellSize() Get the size used for cells in the grid with no item. | **Returns:** `wx.Size `_ -------- .. method:: GetItemPosition(item) Get the grid position of the specified item where `item` is either a window or subsizer that is a member of this sizer, or a zero-based index of an item. **Parameters:** * `item` | **Returns:** `wx.GBPosition `_ -------- .. method:: GetItemSpan(item) Get the row/col spanning of the specified item where `item` is either a window or subsizer that is a member of this sizer, or a zero-based index of an item. **Parameters:** * `item` | **Returns:** `wx.GBSpan `_ -------- .. method:: SetEmptyCellSize(sz) Set the size used for cells in the grid with no item. **Parameters:** * `sz` (`wx.Size `_) -------- .. method:: SetItemPosition(item, pos) Set the grid position of the specified item where `item` is either a window or subsizer that is a member of this sizer, or a zero-based index of an item. Returns ``True`` on success. If the move is not allowed (because an item is already there) then ``False`` is returned. **Parameters:** * `item` * `pos` (`wx.GBPosition `_) | **Returns:** `bool` -------- .. method:: SetItemSpan(item, span) Set the row/col spanning of the specified item where `item` is either a window or subsizer that is a member of this sizer, or a zero-based index of an item. Returns ``True`` on success. If the move is not allowed (because an item is already there) then ``False`` is returned. **Parameters:** * `item` * `span` (`wx.GBSpan `_) | **Returns:** `bool`