Phoenix Logo

phoenix_title wx.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.


class_hierarchy Class Hierarchy

Inheritance diagram for class GridBagSizer:


method_summary Methods Summary

__init__ Constructor, with optional parameters to specify the gap between the rows and columns.
Add Adds the given item to the given position.
CalcMin Called when the managed size of the sizer is needed or when layout needs done.
CheckForIntersection Look at all items and see if any intersect (or would overlap) the given item.
FindItem Find the sizer item for the given window or subsizer, returns None if not found.
FindItemAtPoint Return the sizer item located at the point given in pt, or None if there is no item at that point.
FindItemAtPosition Return the sizer item for the given grid cell, or None if there is no item at that position.
FindItemWithData Return the sizer item that has a matching user data (it only compares pointer values) or None if not found.
GetCellSize Get the size of the specified cell, including hgap and vgap.
GetEmptyCellSize Get the size used for cells in the grid with no item.
GetItemPosition Get the grid position of the specified item.
GetItemSpan Get the row/col spanning of the specified item.
RepositionChildren Called when the managed size of the sizer is needed or when layout needs done.
SetEmptyCellSize Set the size used for cells in the grid with no item.
SetItemPosition Set the grid position of the specified item.
SetItemSpan Set the row/col spanning of the specified item.

api Class API



class wx.GridBagSizer(FlexGridSizer)

Possible constructors:

GridBagSizer(vgap=0, hgap=0)

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.


Methods



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

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

Parameters:
  • vgap (int) –
  • hgap (int) –


Add(self, *args, **kw)

overload Overloaded Implementations:



Add (self, window, pos, span=DefaultSpan, flag=0, border=0, userData=None)

Adds the given item to the given position.

Parameters:
Return type:

wx.SizerItem

Returns:

A valid pointer if the item was successfully placed at the given position, or None if something was already there.



Add (self, sizer, pos, span=DefaultSpan, flag=0, border=0, userData=None)

Adds the given item to the given position.

Parameters:
Return type:

wx.SizerItem

Returns:

A valid pointer if the item was successfully placed at the given position, or None if something was already there.



Add (self, item)

Adds the given item to the given position.

Parameters:item (wx.GBSizerItem) –
Return type: wx.SizerItem
Returns:A valid pointer if the item was successfully placed at the given position, or None if something was already there.



Add (self, width, height, pos, span=DefaultSpan, flag=0, border=0, userData=None)

Adds a spacer to the given position.

width and height specify the dimension of the spacer to be added.

Parameters:
  • width (int) –
  • height (int) –
  • pos (wx.GBPosition) –
  • span (wx.GBSpan) –
  • flag (int) –
  • border (int) –
  • userData (PyUserData) –
Return type:

wx.SizerItem

Returns:

A valid pointer if the spacer was successfully placed at the given position, or None if something was already there.



Add (self, size, pos, span=DefaultSpan, flag=0, border=0, /Transfer/=None)

Add a spacer using a Size object.

Return type: wx.SizerItem





CalcMin(self)

Called when the managed size of the sizer is needed or when layout needs done.

Return type: wx.Size


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:



CheckForIntersection (self, item, excludeItem=None)

Parameters:
Return type:

bool



CheckForIntersection (self, pos, span, excludeItem=None)

Parameters:
Return type:

bool





FindItem(self, *args, **kw)

Find the sizer item for the given window or subsizer, returns None if not found.

(non-recursive)

overload Overloaded Implementations:



FindItem (self, window)

Parameters:window (wx.Window) –
Return type: wx.GBSizerItem



FindItem (self, sizer)

Parameters:sizer (wx.Sizer) –
Return type: wx.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 (wx.Point) –
Return type: wx.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 (wx.GBPosition) –
Return type: wx.GBSizerItem


FindItemWithData(self, userData)

Return the sizer item that has a matching user data (it only compares pointer values) or None if not found.

(non-recursive)

Parameters:userData (wx.Object) –
Return type: wx.GBSizerItem


GetCellSize(self, row, col)

Get the size of the specified cell, including hgap and vgap.

Only valid after window layout has been performed.

Parameters:
  • row (int) –
  • col (int) –
Return type:

wx.Size



GetEmptyCellSize(self)

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

Return type: wx.Size


GetItemPosition(self, *args, **kw)

Get the grid position of the specified item.

overload Overloaded Implementations:



GetItemPosition (self, window)

Parameters:window (wx.Window) –
Return type: wx.GBPosition



GetItemPosition (self, sizer)

Parameters:sizer (wx.Sizer) –
Return type: wx.GBPosition



GetItemPosition (self, index)

Parameters:index (int) –
Return type: wx.GBPosition





GetItemSpan(self, *args, **kw)

Get the row/col spanning of the specified item.

overload Overloaded Implementations:



GetItemSpan (self, window)

Parameters:window (wx.Window) –
Return type: wx.GBSpan



GetItemSpan (self, sizer)

Parameters:sizer (wx.Sizer) –
Return type: wx.GBSpan



GetItemSpan (self, index)

Parameters:index (int) –
Return type: wx.GBSpan





RepositionChildren(self, minSize)

Called when the managed size of the sizer is needed or when layout needs done.

Parameters:minSize (wx.Size) –


SetEmptyCellSize(self, sz)

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

Parameters:sz (wx.Size) –


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:



SetItemPosition (self, window, pos)

Parameters:
Return type:

bool



SetItemPosition (self, sizer, pos)

Parameters:
Return type:

bool



SetItemPosition (self, index, pos)

Parameters:
Return type:

bool





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:



SetItemSpan (self, window, span)

Parameters:
Return type:

bool



SetItemSpan (self, sizer, span)

Parameters:
Return type:

bool



SetItemSpan (self, index, span)

Parameters:
Return type:

bool




Properties



EmptyCellSize

See GetEmptyCellSize and SetEmptyCellSize