class documentation

class _Gap:

View In Hierarchy

A gap within the layout has a direction and a length. Objects are hold in _Cell.item properties

  • Coordinates of a _Gap are not saved in this class, but in class _Cell as _Cell.y and _Cell.x properties.
  • It may display a column index number with a label.
Method __init__ Examples
Instance Variable grid Grid object
Instance Variable is_expander Do this gap expand ?
Instance Variable is_empty Is this gap explicitly empty (gap.item == None) ?
Instance Variable item Object as returned from _gap_item method : None, QLabel or QSpacerItem
Instance Variable label If instance argument index is given, display a label with its number
Instance Variable direction Expanding or size direction 'H', 'V', 'vertical', or 'horizontal'
Instance Variable length Length or size of this gap. Can be None, "expand", or int
Instance Variable index If integer is given, it will be displayed as a label
Method _gap_item Create an object at init time representing this gap: None, QLabel or QSpacerItem
def __init__(self, grid=None, direction=None, length=None, index=-1):

Examples

cell = _Cell( _Gap(...), y=0, x=1, y_span=2, x_span=2 )

# horizontal direction
_Gap(grid)                                 # H, explicit empty
_Gap(grid, direction="H", length=None)     # H, explicit empty
_Gap(grid, direction="H", length=0)        # H, explicit empty
_Gap(grid, direction="H", length=20)       # H, sized (yellow)
_Gap(grid, direction="H", length="expand") # H, expand (blue)
_Gap(grid, direction="H", length="unused") # H, unused (magenta)

# horizontal direction is default
_Gap(grid, length=None)     # H, explicit empty
_Gap(grid, length=0)        # H, explicit empty
_Gap(grid, length=20)       # H, sized (yellow)
_Gap(grid, length="expand") # H, expand (blue)
_Gap(grid, length="unused") # H, unused (magenta)

# vertical direction
_Gap(grid, direction="V", length=None)     # V, explicit empty
_Gap(grid, direction="V", length=0)        # V, explicit empty
_Gap(grid, direction="V", length=20)       # V, sized (yellow)
_Gap(grid, direction="V", length="expand") # V, expand (blue)
_Gap(grid, direction="V", length="unused") # V, unused (magenta)

# If given, the index argument is displayed
_Gap(grid, length=20, index=0)
_Gap(grid, index=20)
ParametersgridGrid (type: object)
direction"H", "V", "horizontal", "vertical" (type: None or str)
length
  • If length == "expand", then add expander.
  • If length == None or 0, then leave the cell empty (also add coordinates to _Spans).
  • If length >= 1, then add fixed size spacer.
(type: None, int, or str)
indexIf given, it will be displayed as a label (type: int)
grid =
Grid object
is_expander =

Do this gap expand ?

if self.is_expander : pass
(type: bool)
is_empty =

Is this gap explicitly empty (gap.item == None) ?

if self.is_empty : pass
(type: bool)
item =
Object as returned from _gap_item method : None, QLabel or QSpacerItem
label =
If instance argument index is given, display a label with its number
direction =
Expanding or size direction 'H', 'V', 'vertical', or 'horizontal'
length =
Length or size of this gap. Can be None, "expand", or int
index =
If integer is given, it will be displayed as a label
def _gap_item(self):

Create an object at init time representing this gap: None, QLabel or QSpacerItem

self.item = self._gap_item()
Visualize expander or gaps with a colored QLabel or a QSpacerItem
with the corresponding expansion, behaviour, or size.
ReturnsNone, QLabel, QSpacerItem (type: QObject)
API Documentation for gtgrid, generated by pydoctor 21.2.2 at 2021-06-12 11:12:41.