.. 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: int=0, hgap: int=0) -> None
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: int=0, hgap: int=0)
Constructor, with optional parameters to specify the gap between the rows and columns.
:param `vgap`:
:type `vgap`: int
:param `hgap`:
:type `hgap`: int
:rtype: `None`
.. method:: Add(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**Add** `(self, window : Window, pos : GBPosition, span: GBSpan=DefaultSpan, flag: int=0, border: int=0, userData: Optional[PyUserData]=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 : Sizer, pos : GBPosition, span: GBSpan=DefaultSpan, flag: int=0, border: int=0, userData: Optional[PyUserData]=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 : GBSizerItem)`
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 : int, height : int, pos : GBPosition, span: GBSpan=DefaultSpan, flag: int=0, border: int=0, userData: Optional[PyUserData]=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: Size, pos: GBPosition, span: GBSpan=DefaultSpan, flag: int=0, border: int=0, Transfer: Optional[ObjectuserData]=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 : GBSizerItem, excludeItem: Optional[GBSizerItem]=None)`
:param `item`:
:type `item`: wx.GBSizerItem
:param `excludeItem`:
:type `excludeItem`: wx.GBSizerItem
:rtype: `bool`
:html:`
`
**CheckForIntersection** `(self, pos : GBPosition, span : GBSpan, excludeItem: Optional[GBSizerItem]=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 : Window)`
:param `window`:
:type `window`: wx.Window
:rtype: :ref:`wx.GBSizerItem`
:html:`
`
**FindItem** `(self, sizer : Sizer)`
:param `sizer`:
:type `sizer`: wx.Sizer
:rtype: :ref:`wx.GBSizerItem`
:html:`
`
.. method:: FindItemAtPoint(self, pt : Point)
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 : GBPosition)
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 : Object)
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 : int, col : int)
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 : Window)`
:param `window`:
:type `window`: wx.Window
:rtype: :ref:`wx.GBPosition`
:html:`
`
**GetItemPosition** `(self, sizer : Sizer)`
:param `sizer`:
:type `sizer`: wx.Sizer
:rtype: :ref:`wx.GBPosition`
:html:`
`
**GetItemPosition** `(self, index : int)`
: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 : Window)`
:param `window`:
:type `window`: wx.Window
:rtype: :ref:`wx.GBSpan`
:html:`
`
**GetItemSpan** `(self, sizer : Sizer)`
:param `sizer`:
:type `sizer`: wx.Sizer
:rtype: :ref:`wx.GBSpan`
:html:`
`
**GetItemSpan** `(self, index : int)`
:param `index`:
:type `index`: int
:rtype: :ref:`wx.GBSpan`
:html:`
`
.. method:: RepositionChildren(self, minSize : Size)
Called when the managed size of the sizer is needed or when layout needs done.
:param `minSize`:
:type `minSize`: wx.Size
:rtype: `None`
.. method:: SetEmptyCellSize(self, sz : Size)
Set the size used for cells in the grid with no item.
:param `sz`:
:type `sz`: wx.Size
:rtype: `None`
.. 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 : Window, pos : GBPosition)`
:param `window`:
:type `window`: wx.Window
:param `pos`:
:type `pos`: wx.GBPosition
:rtype: `bool`
:html:`
`
**SetItemPosition** `(self, sizer : Sizer, pos : GBPosition)`
:param `sizer`:
:type `sizer`: wx.Sizer
:param `pos`:
:type `pos`: wx.GBPosition
:rtype: `bool`
:html:`
`
**SetItemPosition** `(self, index : int, pos : GBPosition)`
: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 : Window, span : GBSpan)`
:param `window`:
:type `window`: wx.Window
:param `span`:
:type `span`: wx.GBSpan
:rtype: `bool`
:html:`
`
**SetItemSpan** `(self, sizer : Sizer, span : GBSpan)`
:param `sizer`:
:type `sizer`: wx.Sizer
:param `span`:
:type `span`: wx.GBSpan
:rtype: `bool`
:html:`
`
**SetItemSpan** `(self, index : int, span : GBSpan)`
: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`