phoenix_title 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 Class Hierarchy

Inheritance diagram for class SizerItem:

sub_classes Known Subclasses

wx.GBSizerItem


method_summary Methods Summary

__init__

Construct a sizer item for tracking a window.

AssignSizer

Set the sizer tracked by this item.

AssignSpacer

Set the size of the spacer tracked by this item.

AssignWindow

Set the window to be tracked by this item.

CalcMin

Calculates the minimum desired size for the item, including any space needed by borders.

DeleteWindows

Destroy the window or the windows in a subsizer, depending on the type of item.

DetachSizer

Enable deleting the SizerItem without destroying the contained sizer.

GetBorder

Return the border attribute.

GetFlag

Return the flags attribute.

GetId

Return the numeric id of wx.SizerItem, or ID_NONE if the id has not been set.

GetMinSize

Get the minimum size needed for the item.

GetPosition

What is the current position of the item, as set in the last Layout.

GetProportion

Get the proportion item attribute.

GetRatio

Get the ratio item attribute.

GetRect

Get the rectangle of the item on the parent window, excluding borders.

GetSize

Get the current size of the item, as set in the last Layout.

GetSizer

If this item is tracking a sizer, return it.

GetSpacer

If this item is tracking a spacer, return its size.

GetUserData

Get the userData item attribute.

GetWindow

If this item is tracking a window then return it.

IsShown

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.

IsSizer

Is this item a sizer?

IsSpacer

Is this item a spacer?

IsWindow

Is this item a window?

SetBorder

Set the border item attribute.

SetDimension

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

Set the flag item attribute.

SetId

Sets the numeric id of the wx.SizerItem to id.

SetInitSize

Sets the minimum size to be allocated for this item.

SetMinSize

Sets the minimum size to be allocated for this item.

SetProportion

Set the proportion item attribute.

SetRatio

Set the ratio item attribute.

SetUserData

Show

Set the show item attribute, which sizers use to determine if the item is to be made part of the layout or not.


property_summary Properties Summary

Border

See GetBorder and SetBorder

Flag

See GetFlag and SetFlag

Id

See GetId and SetId

MinSize

See GetMinSize and SetMinSize

Position

See GetPosition

Proportion

See GetProportion and SetProportion

Ratio

See GetRatio and SetRatio

Rect

See GetRect

Size

See GetSize

Sizer

See GetSizer

Spacer

See GetSpacer

UserData

See GetUserData and SetUserData

Window

See GetWindow


api Class API

class 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.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self, window, flags)

Construct a sizer item for tracking a window.

Parameters:



__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) –



__init__ (self, sizer, flags)

Construct a sizer item for tracking a subsizer.

Parameters:



__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) –



__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) –





AssignSizer(self, sizer)

Set the sizer tracked by this item.

Old sizer, if any, is deleted.

Parameters:

sizer (wx.Sizer) –



AssignSpacer(self, *args, **kw)

Set the size of the spacer tracked by this item.

Old spacer, if any, is deleted.

overload Overloaded Implementations:



AssignSpacer (self, size)

Parameters:

size (wx.Size) –



AssignSpacer (self, w, h)

Parameters:
  • 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.

Parameters:

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.

Return type:

wx.Size



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.

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



GetMinSize(self)

Get the minimum size needed for the item.

Return type:

wx.Size



GetPosition(self)

What is the current position of the item, as set in the last Layout.

Return type:

wx.Point



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:

wx.Rect



GetSize(self)

Get the current size of the item, as set in the last Layout.

Return type:

wx.Size



GetSizer(self)

If this item is tracking a sizer, return it.

None otherwise.

Return type:

wx.Sizer



GetSpacer(self)

If this item is tracking a spacer, return its size.

Return type:

wx.Size



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:

wx.Window



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

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



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.

Parameters:


SetFlag(self, flag)

Set the flag item attribute.

Parameters:

flag (int) –



SetId(self, id)

Sets the numeric id of the wx.SizerItem to id.

Parameters:

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.

Parameters:
  • x (int) –

  • y (int) –



SetMinSize(self, *args, **kw)

overload Overloaded Implementations:



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



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





SetProportion(self, proportion)

Set the proportion item attribute.

Parameters:

proportion (int) –



SetRatio(self, *args, **kw)

Set the ratio item attribute.

overload Overloaded Implementations:



SetRatio (self, width, height)

Parameters:
  • width (int) –

  • height (int) –



SetRatio (self, size)

Parameters:

size (wx.Size) –



SetRatio (self, ratio)

Parameters:

ratio (float) –





SetUserData(self, userData)
Parameters:

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.

Parameters:

show (bool) –


Properties

Border

See GetBorder and SetBorder



Flag

See GetFlag and SetFlag



Id

See GetId and SetId



MinSize

See GetMinSize and SetMinSize



Position

See GetPosition



Proportion

See GetProportion and SetProportion



Ratio

See GetRatio and SetRatio



Rect

See GetRect



Size

See GetSize



Sizer

See GetSizer



Spacer

See GetSpacer



UserData

See GetUserData and SetUserData



Window

See GetWindow