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.
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 id. |
|
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. |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
wx.
SizerItem
(Object)¶Possible constructors:
SizerItem(window, flags)
SizerItem(window, proportion=0, flag=0, border=0, userData=None)
SizerItem(sizer, flags)
SizerItem(sizer, proportion=0, flag=0, border=0, userData=None)
SizerItem(width, height, proportion=0, flag=0, border=0, userData=None)
The SizerItem class is used to track the position, size and other attributes of each item managed by a Sizer.
__init__
(self, *args, **kw)¶__init__ (self, window, flags)
Construct a sizer item for tracking a window.
window (wx.Window) –
flags (wx.SizerFlags) –
__init__ (self, window, proportion=0, flag=0, border=0, userData=None)
Construct a sizer item for tracking a window.
window (wx.Window) –
proportion (int) –
flag (int) –
border (int) –
userData (PyUserData) –
__init__ (self, sizer, flags)
Construct a sizer item for tracking a subsizer.
sizer (wx.Sizer) –
flags (wx.SizerFlags) –
__init__ (self, sizer, proportion=0, flag=0, border=0, userData=None)
Construct a sizer item for tracking a subsizer.
sizer (wx.Sizer) –
proportion (int) –
flag (int) –
border (int) –
userData (PyUserData) –
__init__ (self, width, height, proportion=0, flag=0, border=0, userData=None)
Construct a sizer item for tracking a spacer.
width (int) –
height (int) –
proportion (int) –
flag (int) –
border (int) –
userData (PyUserData) –
AssignSizer
(self, sizer)¶Set the sizer tracked by this item.
Old sizer, if any, is deleted.
sizer (wx.Sizer) –
AssignSpacer
(self, *args, **kw)¶Set the size of the spacer tracked by this item.
Old spacer, if any, is deleted.
AssignSpacer (self, size)
size (wx.Size) –
AssignSpacer (self, w, h)
w (int) –
h (int) –
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.
window (wx.Window) –
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.
DeleteWindows
(self)¶Destroy the window or the windows in a subsizer, depending on the type of item.
DetachSizer
(self)¶Enable deleting the SizerItem without destroying the contained sizer.
GetBorder
(self)¶Return the border attribute.
int
GetFlag
(self)¶Return the flags attribute.
See Sizer flags list for details.
int
GetId
(self)¶Return the numeric id of wx.SizerItem, or ID_NONE
if the id has not been set.
int
GetPosition
(self)¶What is the current position of the item, as set in the last Layout.
GetProportion
(self)¶Get the proportion item attribute.
int
GetRatio
(self)¶Get the ratio item attribute.
float
GetRect
(self)¶Get the rectangle of the item on the parent window, excluding borders.
GetUserData
(self)¶Get the userData item attribute.
PyUserData
GetWindow
(self)¶If this item is tracking a window then return it.
None
otherwise.
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, then IsShown
always returns True
for it (see wx.SizerFlags.ReserveSpaceEvenIfHidden
).
bool
IsSizer
(self)¶Is this item a sizer?
bool
IsSpacer
(self)¶Is this item a spacer?
bool
IsWindow
(self)¶Is this item a window?
bool
SetBorder
(self, border)¶Set the border item attribute.
border (int) –
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.
flag (int) –
SetId
(self, id)¶Sets the numeric id of the wx.SizerItem to id.
id (int) –
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.
x (int) –
y (int) –
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
.
size (wx.Size) –
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.
x (int) –
y (int) –
SetProportion
(self, proportion)¶Set the proportion item attribute.
proportion (int) –
SetRatio
(self, *args, **kw)¶Set the ratio item attribute.
SetRatio (self, width, height)
width (int) –
height (int) –
SetRatio (self, size)
size (wx.Size) –
SetRatio (self, ratio)
ratio (float) –
SetUserData
(self, userData)¶userData (PyUserData) –
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.
show (bool) –
MinSize
¶See GetMinSize
and SetMinSize
Position
¶See GetPosition
Proportion
¶See GetProportion
and SetProportion
UserData
¶See GetUserData
and SetUserData