Home | Trees | Index | Help |
|
---|
Package wx :: Class Sizer |
|
object
--+ |Object
--+ | Sizer
BoxSizer
,
GridSizer
,
PySizer
wx.Sizer is the abstract base class used for laying out subwindows in
a window. You cannot use wx.Sizer directly; instead, you will have to
use one of the sizer classes derived from it such as wx.BoxSizer
,
wx.StaticBoxSizer
, wx.GridSizer
, wx.FlexGridSizer
and
wx.GridBagSizer
.
The concept implemented by sizers in wxWidgets is closely related to layout tools in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit. It is based upon the idea of the individual subwindows reporting their minimal required size and their ability to get stretched if the size of the parent window has changed. This will most often mean that the programmer does not set the original size of a dialog in the beginning, rather the dialog will assigned a sizer and this sizer will be queried about the recommended size. The sizer in turn will query its children, which can be normal windows or contorls, empty space or other sizers, so that a hierarchy of sizers can be constructed. Note that wxSizer does not derive from wxWindow and thus do not interfere with tab ordering and requires very little resources compared to a real window on screen.
What makes sizers so well fitted for use in wxWidgets is the fact that every control reports its own minimal size and the algorithm can handle differences in font sizes or different window (dialog item) sizes on different platforms without problems. If for example the standard font as well as the overall design of Mac widgets requires more space than on Windows, then the initial size of a dialog using a sizer will automatically be bigger on Mac than on Windows.
Sizers may also be used to control the layout of custom drawn items on
the window. The Add
, Insert
, and Prepend
functions return a
pointer to the newly added wx.SizerItem
. Just add empty space of the
desired size and attributes, and then use the wx.SizerItem.GetRect
method to determine where the drawing operations should take place.
Note:
If you wish to create a custom sizer class in wxPython you
should derive the class from wx.PySizer
in order to get
Python-aware capabilities for the various virtual methods.
See Also:
To Do:
More dscriptive text here along with some pictures...
Method Summary | |
---|---|
__init__(self)
| |
__del__(self)
| |
wx.SizerItem |
Appends a child item to the sizer. |
AddF(self, item, wx.SizerFlags flags) -> wx.SizerItem | |
Adds a wx.SizerItem to the sizer. | |
AddMany is a convenience method for adding several items to a sizer at one time. | |
Compatibility alias for Add . | |
AddSpacer(int size) --> SizerItem | |
AddStretchSpacer(int prop=1) --> SizerItem | |
Compatibility alias for Add . | |
Size |
This method is where the sizer will do the actual calculation of its children's minimal sizes. |
Clear all items from the sizer, optionally destroying the window items as well. | |
Destroy all windows managed by the sizer. | |
bool |
Detaches an item from the sizer without destroying it. |
Size |
Tell the sizer to resize the window to match the sizer's minimal size. |
Tell the sizer to resize the virtual size of the window to match the sizer's minimal size. | |
list |
Returns a list of all the wx.SizerItem objects managed by the sizer. |
Window |
Get the window this sizer is used in. |
wx.SizerItem |
Returns the wx.SizerItem which holds the item given. |
Size |
Returns the minimal size of the sizer. |
GetMinSizeTuple(self)
| |
Point |
Returns the current position of the sizer's managed space. |
GetPositionTuple(self)
| |
Size |
Returns the current size of the space managed by the sizer. |
GetSizeTuple(self)
| |
A convenience method for Show (item, False, recursive). | |
wx.SizerItem |
Inserts a new item into the list of items managed by this sizer before the item at index before. |
InsertF(self, int before, item, wx.SizerFlags flags) -> wx.SizerItem | |
Inserts a wx.SizerItem to the sizer at the position given by index. | |
Compatibility alias for Insert . | |
InsertSpacer(int index, int size) --> SizerItem | |
InsertStretchSpacer(int index, int prop=1) --> SizerItem | |
Compatibility alias for Insert . | |
Determines if the item is currently shown. | |
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 |
Adds a new item to the begining of the list of sizer items managed by this sizer. |
PrependF(self, item, wx.SizerFlags flags) -> wx.SizerItem | |
Prepends a wx.SizerItem to the sizer. | |
Compatibility alias for Prepend . | |
PrependSpacer(int size) --> SizerItem | |
PrependStretchSpacer(int prop=1) --> SizerItem | |
Compatibility alias for Prepend . | |
Using the sizes calculated by CalcMin reposition and resize all the
items managed by this sizer. | |
bool |
Removes an item from the sizer and destroys it. |
Compatibility alias for Remove . | |
Compatibility alias for Remove . | |
Compatibility alias for Remove . | |
Detaches the given olditem from the sizer and replaces it with item which can be a window, sizer, or wx.SizerItem . | |
Set (or unset) the window this sizer is used in. | |
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. | |
Sets the minimum size that will be allocated for an item in the sizer. | |
Call this to give the sizer a minimal size. | |
Tell the sizer to set (and Fit ) the minimal size of the window to
match the sizer's minimal size. | |
Tell the sizer to set the minimal size of the window virtual area to match the sizer's minimal size. | |
bool |
Shows or hides an item managed by the sizer. |
Recursively call wx.SizerItem.Show on all sizer items. |
Property Summary | |
---|---|
Children : See GetChildren | |
ContainingWindow : See GetContainingWindow and SetContainingWindow | |
MinSize : See GetMinSize and SetMinSize | |
Position : See GetPosition | |
Size : See GetSize | |
thisown : The membership flag |
Method Details |
---|
Add(self, item, proportion=0, flag=0, border=0, userData=None)Appends a child item to the sizer.
|
AddF(*args, **kwargs)AddF(self, item, wx.SizerFlags flags) -> wx.SizerItem Similar to |
AddItem(self, item)Adds a
|
AddMany(self, items)AddMany is a convenience method for adding several items
to a sizer at one time. Simply pass it a list of tuples,
where each tuple consists of the parameters that you
would normally pass to the |
AddSizer(self, *args, **kw)Compatibility alias for |
AddSpacer(self, *args, **kw)AddSpacer(int size) --> SizerItem Add a spacer that is (size,size) pixels. |
AddStretchSpacer(self, prop=1)AddStretchSpacer(int prop=1) --> SizerItem Add a stretchable spacer. |
AddWindow(self, *args, **kw)Compatibility alias for |
CalcMin(self)This method is where the sizer will do the actual calculation of its
children's minimal sizes. You should not need to call this directly as
it is called by
|
Clear(self, deleteWindows=False)Clear all items from the sizer, optionally destroying the window items as well.
|
DeleteWindows(self)Destroy all windows managed by the sizer. |
Detach(self, item)Detaches an item from the sizer without destroying it. This method
does not cause any layout or resizing to take place, call
|
Fit(self, window)Tell the sizer to resize the window to match the sizer's minimal size. This is commonly done in the constructor of the window itself in order to set its initial size to match the needs of the children as determined by the sizer. Returns the new size. For a top level window this is the total window size, not the client size.
|
FitInside(self, window)Tell the sizer to resize the virtual size of the window to match the sizer's minimal size. This will not alter the on screen size of the window, but may cause the addition/removal/alteration of scrollbars required to view the virtual area in windows which manage it.
|
GetChildren(self)Returns a list of all the
|
GetContainingWindow(self)Get the window this sizer is used in.
|
GetItem(self, item, recursive=False)Returns the
|
GetMinSize(self)Returns the minimal size of the sizer. This is either the combined minimal size of all the children and their borders or the minimal size set by SetMinSize, depending on which is bigger.
|
GetPosition(self)Returns the current position of the sizer's managed space.
|
GetSize(self)Returns the current size of the space managed by the sizer.
|
Hide(self, item, recursive=False)A convenience method for |
Insert(self, before, item, proportion=0, flag=0, border=0, userData=None)Inserts a new item into the list of items managed by this sizer before
the item at index before. See
|
InsertF(*args, **kwargs)InsertF(self, int before, item, wx.SizerFlags flags) -> wx.SizerItem Similar to |
InsertItem(self, index, item)Inserts a
|
InsertSizer(self, *args, **kw)Compatibility alias for |
InsertSpacer(self, index, *args, **kw)InsertSpacer(int index, int size) --> SizerItem Insert a spacer at position index that is (size, size) pixels. |
InsertStretchSpacer(self, index, prop=1)InsertStretchSpacer(int index, int prop=1) --> SizerItem Insert a stretchable spacer. |
InsertWindow(self, *args, **kw)Compatibility alias for |
IsShown(self, item)Determines if the item is currently shown. To make a sizer
item disappear or reappear, use Show followed by |
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. Normally this is called automatically from the owning window's EVT_SIZE handler, but it is also useful to call it from user code when one of the items in a sizer change size, or items are added or removed. |
Prepend(self, item, proportion=0, flag=0, border=0, userData=None)Adds a new item to the begining of the list of sizer items managed by
this sizer. See
|
PrependF(*args, **kwargs)PrependF(self, item, wx.SizerFlags flags) -> wx.SizerItem Similar to |
PrependItem(self, item)Prepends a
|
PrependSizer(self, *args, **kw)Compatibility alias for |
PrependSpacer(self, *args, **kw)PrependSpacer(int size) --> SizerItem Prepend a spacer that is (size, size) pixels. |
PrependStretchSpacer(self, prop=1)PrependStretchSpacer(int prop=1) --> SizerItem Prepend a stretchable spacer. |
PrependWindow(self, *args, **kw)Compatibility alias for |
RecalcSizes(self)Using the sizes calculated by |
Remove(self, item)Removes an item from the sizer and destroys it. This method does not
cause any layout or resizing to take place, call |
RemovePos(self, *args, **kw)Compatibility alias for |
RemoveSizer(self, *args, **kw)Compatibility alias for |
RemoveWindow(self, *args, **kw)Compatibility alias for |
Replace(self, olditem, item, recursive=False)Detaches the given olditem from the sizer and replaces it with
item which can be a window, sizer, or This method does not cause any layout or resizing to take place,
call Returns True if the child item was found and removed. |
SetContainingWindow(self, window)Set (or unset) the window this sizer is used in.
|
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
|
SetItemMinSize(self, item, size)Sets the minimum size that will be allocated for an item in the sizer. The item parameter can be either a window, a sizer, or the zero-based index of the item. If a window or sizer is given then it will be searched for recursivly in subsizers if neccessary.
|
SetMinSize(self, size)Call this to give the sizer a minimal size. Normally, the sizer will
calculate its minimal size based purely on how much space its children
need. After calling this method
|
SetSizeHints(self, window)Tell the sizer to set (and
|
SetVirtualSizeHints(self, window)Tell the sizer to set the minimal size of the window virtual area to match the sizer's minimal size. For windows with managed scrollbars this will set them appropriately.
|
Show(self, item, show=True, recursive=false)Shows or hides an item managed by the sizer. To make a sizer item
disappear or reappear, use Show followed by
|
ShowItems(self, show)Recursively call
|
Property Details |
---|
ChildrenSee
|
ContainingWindowSee
|
MinSizeSee
|
PositionSee
|
SizeSee
|
thisownThe membership flag |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:12:28 2007 | http://epydoc.sf.net |