.. include:: headings.inc .. _GBSizerItem: ========================================================================================================================================== |phoenix_title| **GBSizerItem** ========================================================================================================================================== The :ref:`GBSizerItem` class is used by the :ref:`GridBagSizer` for tracking the items in the sizer. It adds grid position and spanning information to the normal :ref:`SizerItem` by adding :ref:`GBPosition` and :ref:`GBSpan` attributes. Most of the time you will not need to use a :ref:`GBSizerItem` directly in your code, but there are a couple of cases where it is handy. | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **GBSizerItem** .. raw:: html

Inheritance diagram of GBSizerItem

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~GBSizerItem.__init__` Construct a sizer item for tracking a spacer. :meth:`~GBSizerItem.GetEndPos` Get the row and column of the endpoint of this item. :meth:`~GBSizerItem.GetGBSizer` :meth:`~GBSizerItem.GetPos` Get the grid position of the item. :meth:`~GBSizerItem.GetSpan` Get the row and column spanning of the item. :meth:`~GBSizerItem.Intersects` Returns ``True`` if this item and the `other` item intersect. :meth:`~GBSizerItem.SetGBSizer` :meth:`~GBSizerItem.SetPos` If the item is already a member of a sizer then first ensure that there is no other item that would intersect with this one at the new position, then set the new position. :meth:`~GBSizerItem.SetSpan` If the item is already a member of a sizer then first ensure that there is no other item that would intersect with this one with its new spanning size, then set the new spanning. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~GBSizerItem.GBSizer` See :meth:`~GBSizerItem.GetGBSizer` and :meth:`~GBSizerItem.SetGBSizer` :attr:`~GBSizerItem.Pos` See :meth:`~GBSizerItem.GetPos` and :meth:`~GBSizerItem.SetPos` :attr:`~GBSizerItem.Span` See :meth:`~GBSizerItem.GetSpan` and :meth:`~GBSizerItem.SetSpan` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: GBSizerItem(SizerItem) The GBSizerItem class is used by the GridBagSizer for tracking the items in the sizer. **Possible constructors**:: GBSizerItem(width, height, pos, span=DefaultSpan, flag=0, border=0, userData=None) GBSizerItem(window, pos, span=DefaultSpan, flag=0, border=0, userData=None) GBSizerItem(sizer, pos, span=DefaultSpan, flag=0, border=0, userData=None) .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__init__** `(self, width, height, pos, span=DefaultSpan, flag=0, border=0, userData=None)` Construct a sizer item for tracking a spacer. :param `width`: :type `width`: int :param `height`: :type `height`: int :param `pos`: :type `pos`: GBPosition :param `span`: :type `span`: GBSpan :param `flag`: :type `flag`: int :param `border`: :type `border`: int :param `userData`: :type `userData`: PyUserData **~~~** **__init__** `(self, window, pos, span=DefaultSpan, flag=0, border=0, userData=None)` Construct a sizer item for tracking a window. :param `window`: :type `window`: Window :param `pos`: :type `pos`: GBPosition :param `span`: :type `span`: GBSpan :param `flag`: :type `flag`: int :param `border`: :type `border`: int :param `userData`: :type `userData`: PyUserData **~~~** **__init__** `(self, sizer, pos, span=DefaultSpan, flag=0, border=0, userData=None)` Construct a sizer item for tracking a subsizer. :param `sizer`: :type `sizer`: Sizer :param `pos`: :type `pos`: GBPosition :param `span`: :type `span`: GBSpan :param `flag`: :type `flag`: int :param `border`: :type `border`: int :param `userData`: :type `userData`: PyUserData **~~~** .. method:: GetEndPos(self) Get the row and column of the endpoint of this item. :rtype: `tuple` :returns: ( `row`, `col` ) .. method:: GetGBSizer(self) :rtype: :ref:`GridBagSizer` .. method:: GetPos(self, *args, **kw) Get the grid position of the item. .. method:: GetSpan(self, *args, **kw) Get the row and column spanning of the item. .. method:: Intersects(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **Intersects** `(self, other)` Returns ``True`` if this item and the `other` item intersect. :param `other`: :type `other`: GBSizerItem :rtype: `bool` **~~~** **Intersects** `(self, pos, span)` Returns ``True`` if the given pos/span would intersect with this item. :param `pos`: :type `pos`: GBPosition :param `span`: :type `span`: GBSpan :rtype: `bool` **~~~** .. method:: SetGBSizer(self, sizer) :param `sizer`: :type `sizer`: GridBagSizer .. method:: SetPos(self, pos) If the item is already a member of a sizer then first ensure that there is no other item that would intersect with this one at the new position, then set the new position. Returns ``True`` if the change is successful and after the next Layout the item will be moved. :param `pos`: :type `pos`: GBPosition :rtype: `bool` .. method:: SetSpan(self, span) If the item is already a member of a sizer then first ensure that there is no other item that would intersect with this one with its new spanning size, then set the new spanning. Returns ``True`` if the change is successful and after the next Layout the item will be resized. :param `span`: :type `span`: GBSpan :rtype: `bool` .. attribute:: GBSizer See :meth:`~GBSizerItem.GetGBSizer` and :meth:`~GBSizerItem.SetGBSizer` .. attribute:: Pos See :meth:`~GBSizerItem.GetPos` and :meth:`~GBSizerItem.SetPos` .. attribute:: Span See :meth:`~GBSizerItem.GetSpan` and :meth:`~GBSizerItem.SetSpan`