wx.SizerItem¶
The wx.SizerItem class is used to track the position, size and other attributes of each item managed by a wx.Sizer.
It is not usually necessary to use this class because the sizer elements can also be identified by their positions or window or sizer pointers but sometimes it may be more convenient to use it directly.
Class Hierarchy¶
Known Subclasses¶
Methods Summary¶
Construct a sizer item for tracking a window. |
|
Set the sizer tracked by this item. |
|
Set the size of the spacer tracked by this item. |
|
Set the window to be tracked by this item. |
|
Calculates the minimum desired size for the item, including any space needed by borders. |
|
Destroy the window or the windows in a subsizer, depending on the type of item. |
|
Enable deleting the SizerItem without destroying the contained sizer. |
|
Return the border attribute. |
|
Return the flags attribute. |
|
Return the numeric id of wx.SizerItem, or |
|
Get the minimum size needed for the item. |
|
What is the current position of the item, as set in the last Layout. |
|
Get the proportion item attribute. |
|
Get the ratio item attribute. |
|
Get the rectangle of the item on the parent window, excluding borders. |
|
Get the current size of the item, as set in the last Layout. |
|
If this item is tracking a sizer, return it. |
|
If this item is tracking a spacer, return its size. |
|
Get the userData item attribute. |
|
If this item is tracking a window then return it. |
|
Returns |
|
Is this item a sizer? |
|
Is this item a spacer? |
|
Is this item a window? |
|
Set the border item attribute. |
|
Set the position and size of the space allocated to the sizer, and adjust the position and size of the item to be within that space taking alignment and borders into account. |
|
Set the flag item attribute. |
|
Sets the numeric id of the wx.SizerItem to |
|
Sets the minimum size to be allocated for this item. |
|
Sets the minimum size to be allocated for this item. |
|
Set the proportion item attribute. |
|
Set the ratio item attribute. |
|
Set the show item attribute, which sizers use to determine if the item is to be made part of the layout or not. |
Properties Summary¶
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
Class API¶
- class wx.SizerItem(Object)¶
Possible constructors:
SizerItem(window, flags) -> None SizerItem(window, proportion=0, flag=0, border=0, userData=None) -> None SizerItem(sizer, flags) -> None SizerItem(sizer, proportion=0, flag=0, border=0, userData=None) -> None SizerItem(width, height, proportion=0, flag=0, border=0, userData=None) -> None
The SizerItem class is used to track the position, size and other attributes of each item managed by a Sizer.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self, window, flags)
Construct a sizer item for tracking a window.
- Parameters:
window (wx.Window)
flags (wx.SizerFlags)
- Return type:
None
__init__ (self, window, proportion=0, flag=0, border=0, userData=None)
Construct a sizer item for tracking a window.
- Parameters:
window (wx.Window)
proportion (int)
flag (int)
border (int)
userData (PyUserData)
- Return type:
None
__init__ (self, sizer, flags)
Construct a sizer item for tracking a subsizer.
- Parameters:
sizer (wx.Sizer)
flags (wx.SizerFlags)
- Return type:
None
__init__ (self, sizer, proportion=0, flag=0, border=0, userData=None)
Construct a sizer item for tracking a subsizer.
- Parameters:
sizer (wx.Sizer)
proportion (int)
flag (int)
border (int)
userData (PyUserData)
- Return type:
None
__init__ (self, width, height, proportion=0, flag=0, border=0, userData=None)
Construct a sizer item for tracking a spacer.
- Parameters:
width (int)
height (int)
proportion (int)
flag (int)
border (int)
userData (PyUserData)
- Return type:
None
- AssignSizer(self, sizer)¶
Set the sizer tracked by this item.
Old sizer, if any, is deleted.
- Parameters:
sizer (wx.Sizer)
- Return type:
None
- AssignSpacer(self, *args, **kw)¶
Set the size of the spacer tracked by this item.
Old spacer, if any, is deleted.
AssignSpacer (self, size)
- Parameters:
size (wx.Size)
- Return type:
None
AssignSpacer (self, w, h)
- Parameters:
w (int)
h (int)
- Return type:
None
- AssignWindow(self, window)¶
Set the window to be tracked by this item.
If the sizer item previously contained a window, it is dissociated from the sizer containing this sizer item (if any), but this object doesn’t have the pointer to the containing sizer and so it’s the caller’s responsibility to call
wx.Window.SetContainingSizer
on window. Failure to do this can result in memory corruption when the window is destroyed later, so it is crucial to not forget to do it.Also note that the previously contained window is not deleted, so it’s also the callers responsibility to do it, if necessary.
- Parameters:
window (wx.Window)
- Return type:
None
Note
This is a low-level method which is dangerous if used incorrectly, avoid using it if possible, i.e. if higher level methods such as
wx.Sizer.Replace
can be used instead.
- CalcMin(self)¶
Calculates the minimum desired size for the item, including any space needed by borders.
- Return type:
- DeleteWindows(self)¶
Destroy the window or the windows in a subsizer, depending on the type of item.
- Return type:
None
- DetachSizer(self)¶
Enable deleting the SizerItem without destroying the contained sizer.
- Return type:
None
- GetBorder(self)¶
Return the border attribute.
- Return type:
int
- GetFlag(self)¶
Return the flags attribute.
See Sizer flags list for details.
- Return type:
int
- GetId(self)¶
Return the numeric id of wx.SizerItem, or
ID_NONE
if the id has not been set.- Return type:
int
- GetPosition(self)¶
What is the current position of the item, as set in the last Layout.
- Return type:
- GetProportion(self)¶
Get the proportion item attribute.
- Return type:
int
- GetRatio(self)¶
Get the ratio item attribute.
- Return type:
float
- GetRect(self)¶
Get the rectangle of the item on the parent window, excluding borders.
- Return type:
- GetUserData(self)¶
Get the userData item attribute.
- Return type:
PyUserData
- GetWindow(self)¶
If this item is tracking a window then return it.
None
otherwise.- Return type:
- IsShown(self)¶
Returns
True
if this item is a window or a spacer and it is shown or if this item is a sizer and not all of its elements are hidden.In other words, for sizer items, all of the child elements must be hidden for the sizer itself to be considered hidden.
As an exception, if the
RESERVE_SPACE_EVEN_IF_HIDDEN
flag was used for this sizer item, thenIsShown
always returnsTrue
for it (seewx.SizerFlags.ReserveSpaceEvenIfHidden
).- Return type:
bool
- IsSizer(self)¶
Is this item a sizer?
- Return type:
bool
- IsSpacer(self)¶
Is this item a spacer?
- Return type:
bool
- IsWindow(self)¶
Is this item a window?
- Return type:
bool
- SetBorder(self, border)¶
Set the border item attribute.
- Parameters:
border (int)
- Return type:
None
- SetDimension(self, pos, size)¶
Set the position and size of the space allocated to the sizer, and adjust the position and size of the item to be within that space taking alignment and borders into account.
- SetFlag(self, flag)¶
Set the flag item attribute.
- Parameters:
flag (int)
- Return type:
None
- SetId(self, id)¶
Sets the numeric id of the wx.SizerItem to
id
.- Parameters:
id (int)
- Return type:
None
- SetInitSize(self, x, y)¶
Sets the minimum size to be allocated for this item.
This is identical to
SetMinSize
, prefer to use the other function, as its name is more clear.- Parameters:
x (int)
y (int)
- Return type:
None
- SetMinSize(self, *args, **kw)¶
-
SetMinSize (self, size)
Sets the minimum size to be allocated for this item.
If this item is a window, the size is also passed to
wx.Window.SetMinSize
.- Parameters:
size (wx.Size)
- Return type:
None
SetMinSize (self, x, y)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters:
x (int)
y (int)
- Return type:
None
- SetProportion(self, proportion)¶
Set the proportion item attribute.
- Parameters:
proportion (int)
- Return type:
None
- SetRatio(self, *args, **kw)¶
Set the ratio item attribute.
SetRatio (self, width, height)
- Parameters:
width (int)
height (int)
- Return type:
None
SetRatio (self, size)
- Parameters:
size (wx.Size)
- Return type:
None
SetRatio (self, ratio)
- Parameters:
ratio (float)
- Return type:
None
- SetUserData(self, userData)¶
- Parameters:
userData (PyUserData)
- Return type:
None
- Show(self, show)¶
Set the show item attribute, which sizers use to determine if the item is to be made part of the layout or not.
If the item is tracking a window then it is shown or hidden as needed.
- Parameters:
show (bool)
- Return type:
None
Properties¶
- MinSize¶
See
GetMinSize
andSetMinSize
- Position¶
See
GetPosition
- Proportion¶
See
GetProportion
andSetProportion
- UserData¶
See
GetUserData
andSetUserData