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.
  __repr__(self)
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.
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.
    Inherited from FlexGridSizer
  AddGrowableCol(self, idx, proportion)
Specifies that column idx (starting from zero) should be grown if there is extra space available to the sizer.
  AddGrowableRow(self, idx, proportion)
Specifies that row idx (starting from zero) should be grown if there is extra space available to the sizer.
list GetColWidths(self)
Returns a list of integers representing the widths of each of the columns in the sizer.
int GetFlexibleDirection(self)
Returns a value that specifies whether the sizer flexibly resizes its columns, rows, or both (default).
int GetNonFlexibleGrowMode(self)
Returns the value that specifies how the sizer grows in the non-flexible direction if there is one.
list GetRowHeights(self)
Returns a list of integers representing the heights of each of the rows in the sizer.
  RemoveGrowableCol(self, idx)
Specifies that column idx is no longer growable.
  RemoveGrowableRow(self, idx)
Specifies that row idx is no longer growable.
  SetFlexibleDirection(self, direction)
Specifies whether the sizer should flexibly resize its columns, rows, or both.
  SetNonFlexibleGrowMode(self, mode)
Specifies how the sizer should grow in the non-flexible direction if there is one (so SetFlexibleDirection must have been called previously).
    Inherited from GridSizer
(rows, cols) CalcRowsCols()
Calculates how many rows and columns will be in the sizer based on the current number of items and also the rows, cols specified in the constructor.
int GetCols(self)
Returns the number of columns in the sizer, as specified in the constructor.
int GetHGap(self)
Returns the horizontal gap (in pixels) between cells in the sizer.
int GetRows(self)
Returns the number of rows in the sizer, as specified in the constructor.
int GetVGap(self)
Returns the vertical gap (in pixels) between the cells in the sizer.
  SetCols(self, cols)
Sets the number of columns in the sizer.
  SetHGap(self, gap)
Sets the horizontal gap (in pixels) between cells in the sizer
  SetRows(self, rows)
Sets the number of rows in the sizer.
  SetVGap(self, gap)
Sets the vertical gap (in pixels) between the cells in the sizer.
    Inherited from Sizer
  AddMany(self, items)
AddMany is a convenience method for adding several items to a sizer at one time.
  AddSizer(self, *args, **kw)
Compatibility alias for Add.
  AddSpacer(self, *args, **kw)
Compatibility alias for Add.
  AddWindow(self, *args, **kw)
Compatibility alias for Add.
Size CalcMin(self)
This method is where the sizer will do the actual calculation of its children's minimal sizes.
  Clear(self, deleteWindows)
Clear all items from the sizer, optionally destroying the window items as well.
  DeleteWindows(self)
Destroy all windows managed by the sizer.
bool Detach(self, item)
Detaches an item from the sizer without destroying it.
Size Fit(self, window)
Tell the sizer to resize the window to match the sizer's minimal size.
  FitInside(self, window)
Tell the sizer to resize the virtual size of the window to match the sizer's minimal size.
list GetChildren(self)
Returns a list of all the wx.SizerItem objects managed by the sizer.
wx.SizerItem GetItem(self, item)
Returns the wx.SizerItem which holds the item given.
Size GetMinSize(self)
Returns the minimal size of the sizer.
  GetMinSizeTuple(self)
Point GetPosition(self)
Returns the current position of the sizer's managed space.
  GetPositionTuple(self)
Size GetSize(self)
Returns the current size of the space managed by the sizer.
  GetSizeTuple(self)
  Hide(self, item, recursive)
A convenience method for Show (item, False, recursive).
wx.SizerItem Insert(self, before, item, proportion, flag, border, userData)
Inserts a new item into the list of items managed by this sizer before the item at index before.
  InsertItem(self, index, item)
Inserts a wx.SizerItem to the sizer at the position given by index.
  InsertSizer(self, *args, **kw)
Compatibility alias for Insert.
  InsertSpacer(self, *args, **kw)
Compatibility alias for Insert.
  InsertWindow(self, *args, **kw)
Compatibility alias for Insert.
  IsShown(self, item)
Determines if the item is currently shown.
  Layout(self)
This method will force the recalculation and layout of the items controlled by the sizer using the current space allocated to the sizer.
wx.SizerItem Prepend(self, item, proportion, flag, border, userData)
Adds a new item to the begining of the list of sizer items managed by this sizer.
  PrependItem(self, item)
Prepends a wx.SizerItem to the sizer.
  PrependSizer(self, *args, **kw)
Compatibility alias for Prepend.
  PrependSpacer(self, *args, **kw)
Compatibility alias for Prepend.
  PrependWindow(self, *args, **kw)
Compatibility alias for Prepend.
  RecalcSizes(self)
Using the sizes calculated by CalcMin reposition and resize all the items managed by this sizer.
bool Remove(self, item)
Removes an item from the sizer and destroys it.
  RemovePos(self, *args, **kw)
Compatibility alias for Remove.
  RemoveSizer(self, *args, **kw)
Compatibility alias for Remove.
  RemoveWindow(self, *args, **kw)
Compatibility alias for Remove.
  SetDimension(self, x, y, width, height)
Call this to force the sizer to take the given dimension and thus force the items owned by the sizer to resize themselves according to the rules defined by the parameter in the Add, Insert or Prepend methods.
  SetItemMinSize(self, item, size)
Sets the minimum size that will be allocated for an item in the sizer.
  SetMinSize(self, size)
Call this to give the sizer a minimal size.
  SetSizeHints(self, window)
Tell the sizer to set (and Fit) the minimal size of the window to match the sizer's minimal size.
  SetVirtualSizeHints(self, window)
Tell the sizer to set the minimal size of the window virtual area to match the sizer's minimal size.
bool Show(self, item, show, recursive)
Shows or hides an item managed by the sizer.
  ShowItems(self, show)
Recursively call wx.SizerItem.Show on all sizer items.
    Inherited from Object
  Destroy(self)
Deletes the C++ object this Python object is a proxy for.
String GetClassName(self)
Returns the class name of the C++ class using wxRTTI.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

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

Generated by Epydoc 2.1.20050511.rpd on Sat Jun 16 16:46:00 2007 http://epydoc.sf.net