Package wx :: Class GridBagSizer

[frames | no frames]

## Type GridBagSizer

    object --+
             |
        Object --+
                 |
             Sizer --+
                     |
             GridSizer --+
                         |
             FlexGridSizer --+
                             |
                            GridBagSizer

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`. The total size of the virtual grid is determined by the largest row and column that items are positioned at, adjusted for spanning.

Method Summary
GridBagSizer | ``__init__`(self, vgap, hgap)` Constructor, with optional parameters to specify the gap between the rows and columns.
wx.GBSizerItem | ``Add`(self, item, pos, span, flag, border, userData)` Adds an item to the sizer at the grid cell pos, optionally spanning more than one row or column as specified with span.
| ``AddItem`(*args, **kwargs)` Add(self, GBSizerItem item) -> wx.GBSizerItem
bool | ``CheckForIntersection`(self, item, excludeItem)` Look at all items and see if any intersect (or would overlap) the given item.
bool | ``CheckForIntersectionPos`(self, pos, span, excludeItem)` Look at all items and see if any intersect (or would overlap) the given position and span.
GBSizerItem | ``FindItem`(self, item)` Find the sizer item for the given window or subsizer, returns None if not found.
GBSizerItem | ``FindItemAtPoint`(self, pt)` Return the sizer item located at the point given in pt, or None if there is no item at that point.
GBSizerItem | ``FindItemAtPosition`(self, pos)` Return the sizer item for the given grid cell, or None if there is no item at that position.
Size | ``GetCellSize`(self, row, col)` Get the size of the specified cell, including hgap and vgap.
Size | ``GetEmptyCellSize`(self)` Get the size used for cells in the grid with no item.
| `GetItem(self, item)`
GBPosition | ``GetItemPosition`(self, 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.
GBSpan | ``GetItemSpan`(self, 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.
| ``SetEmptyCellSize`(self, sz)` Set the size used for cells in the grid with no item.
bool | ``SetItemPosition`(self, 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.
bool | ``SetItemSpan`(self, 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.

Property Summary
| `thisown`: The membership flag

Method Details

### __init__(self, vgap=0, hgap=0)
(Constructor)

Constructor, with optional parameters to specify the gap between the rows and columns.

  Parameters:
    `vgap`
    (type=int)

    `hgap`
    (type=int)

  Returns:
    GridBagSizer
  Overrides:
    `wx.FlexGridSizer.__init__`

### Add(self, item, pos, span=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`
    (type=GBPosition)

    `span`
    (type=GBSpan)

    `flag`
    (type=int)

    `border`
    (type=int)

  Returns:
    wx.GBSizerItem
  Overrides:
    `wx.Sizer.Add`

### AddItem(*args, **kwargs)

Add(self, GBSizerItem item) -> wx.GBSizerItem

Add an item to the sizer using a `wx.GBSizerItem`. Returns True if the item was successfully placed at its given cell position, False if something was already there.

  Overrides:
    `wx.Sizer.AddItem`

### CheckForIntersection(self, 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`
    (type=GBSizerItem)

    `excludeItem`
    (type=GBSizerItem)

  Returns:
    bool

### CheckForIntersectionPos(self, 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`
    (type=GBPosition)

    `span`
    (type=GBSpan)

    `excludeItem`
    (type=GBSizerItem)

  Returns:
    bool

### FindItem(self, item)

Find the sizer item for the given window or subsizer, returns None if not found. (non-recursive)

  Returns:
    GBSizerItem

### 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)

  Parameters:
    `pt`
    (type=Point)

  Returns:
    GBSizerItem

### FindItemAtPosition(self, pos)

Return the sizer item for the given grid cell, or None if there is no item at that position. (non-recursive)

  Parameters:
    `pos`
    (type=GBPosition)

  Returns:
    GBSizerItem

### GetCellSize(self, row, col)

Get the size of the specified cell, including hgap and vgap. Only valid after a Layout.

  Parameters:
    `row`
    (type=int)

    `col`
    (type=int)

  Returns:
    Size

### GetEmptyCellSize(self)

Get the size used for cells in the grid with no item.

  Returns:
    Size

### GetItemPosition(self, 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.

  Returns:
    GBPosition

### GetItemSpan(self, 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.

  Returns:
    GBSpan

### SetEmptyCellSize(self, sz)

Set the size used for cells in the grid with no item.

  Parameters:
    `sz`
    (type=Size)

### SetItemPosition(self, 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:
    `pos`
    (type=GBPosition)

  Returns:
    bool

### SetItemSpan(self, 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:
    `span`
    (type=GBSpan)

  Returns:
    bool

Property Details

### thisown

The membership flag

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:12:28 2007 | http://epydoc.sf.net