Home | Trees | Index | Help |
|
---|
|
object
--+ |Object
--+ | Sizer
BoxSizer
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.NotebookSizer`, `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.Method Summary | |
---|---|
__init__(self)
| |
__repr__(self)
| |
_SetItemMinSize(self, PyObject item, Size size) | |
_setOORInfo(self, PyObject _self) | |
Add(self, item, int proportion=0, int flag=0, int border=0, PyObject userData=None) -> wx.SizerItem Appends a child item to the sizer. | |
AddItem(self, SizerItem item) | |
AddMany is a convenience method for adding several items to a sizer at one time. | |
Compatibility alias for `Add`. | |
Compatibility alias for `Add`. | |
Compatibility alias for `Add`. | |
Size |
This method is where the sizer will do the actual calculation of its children's minimal sizes. |
Clear(self, bool deleteWindows=False) | |
Destroy all windows managed by the sizer. | |
bool |
Detaches an item from the sizer without destroying it. |
Fit(self, Window window) -> Size | |
FitInside(self, Window window) | |
list |
Returns a list of all the `wx.SizerItem` objects managed by the sizer. |
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). | |
Insert(self, int before, item, int proportion=0, int flag=0, int border=0, PyObject userData=None) -> wx.SizerItem Inserts a new item into the list of items managed by this sizer before the item at index *before*. | |
InsertItem(self, int index, SizerItem item) | |
Compatibility alias for `Insert`. | |
Compatibility alias for `Insert`. | |
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. | |
Prepend(self, item, int proportion=0, int flag=0, int border=0, PyObject userData=None) -> wx.SizerItem Adds a new item to the begining of the list of sizer items managed by this sizer. | |
PrependItem(self, SizerItem item) | |
Compatibility alias for `Prepend`. | |
Compatibility alias for `Prepend`. | |
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`. | |
SetDimension(self, int x, int y, int width, int height) | |
SetItemMinSize(self, item, Size size) | |
SetMinSize(self, Size size) | |
SetSizeHints(self, Window window) | |
SetVirtualSizeHints(self, Window window) | |
Show(self, item, bool show=True, bool recursive=false) -> bool | |
ShowItems(self, bool show) | |
Inherited from Object | |
Deletes the C++ object this Python object is a proxy for. | |
String |
Returns the class name of the C++ class using wxRTTI. |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
Return hash(x)... | |
Return a new object with type S, a subtype of T... | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
Return str(x)... |
Method Details |
---|
__init__(self)
|
__repr__(self)
|
_SetItemMinSize(*args, **kwargs)_SetItemMinSize(self, PyObject item, Size size) |
_setOORInfo(*args, **kwargs)_setOORInfo(self, PyObject _self) |
Add(*args, **kwargs)Add(self, item, int proportion=0, int flag=0, int border=0, PyObject userData=None) -> wx.SizerItem Appends a child item to the sizer. |
AddItem(*args, **kwargs)AddItem(self, SizerItem item) Adds a `wx.SizerItem` to the sizer. |
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 `Add` method. |
AddSizer(self, *args, **kw)Compatibility alias for `Add`. |
AddSpacer(self, *args, **kw)Compatibility alias for `Add`. |
AddWindow(self, *args, **kw)Compatibility alias for `Add`. |
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 `Layout`.
|
Clear(*args, **kwargs)Clear(self, bool 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 `Layout` to do so. The *item* parameter can be either a window, a sizer, or the zero-based index of the item to be detached. Returns True if the child item was found and detached.
|
Fit(*args, **kwargs)Fit(self, Window window) -> Size 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(*args, **kwargs)FitInside(self, Window 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. :see: `wx.ScrolledWindow.SetScrollbars`, `SetVirtualSizeHints` |
GetChildren(self)Returns a list of all the `wx.SizerItem` objects managed by the sizer.
|
GetItem(self, item)Returns the `wx.SizerItem` which holds the *item* given. The *item* parameter can be either a window, a sizer, or the zero-based index of the item to be detached.
|
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.
|
GetMinSizeTuple(self) |
GetPosition(self)Returns the current position of the sizer's managed space.
|
GetPositionTuple(self) |
GetSize(self)Returns the current size of the space managed by the sizer.
|
GetSizeTuple(self) |
Hide(self, item, recursive=False)A convenience method for `Show` (item, False, recursive). |
Insert(*args, **kwargs)Insert(self, int before, item, int proportion=0, int flag=0, int border=0, PyObject userData=None) -> wx.SizerItem Inserts a new item into the list of items managed by this sizer before the item at index *before*. See `Add` for a description of the parameters. |
InsertItem(*args, **kwargs)InsertItem(self, int index, SizerItem item) Inserts a `wx.SizerItem` to the sizer at the position given by *index*. |
InsertSizer(self, *args, **kw)Compatibility alias for `Insert`. |
InsertSpacer(self, *args, **kw)Compatibility alias for `Insert`. |
InsertWindow(self, *args, **kw)Compatibility alias for `Insert`. |
IsShown(self, item)Determines if the item is currently shown. sizer. To make a sizer item disappear or reappear, use Show followed by `Layout`. The *item* parameter can be either a window, a sizer, or the zero-based index of the item. |
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(*args, **kwargs)Prepend(self, item, int proportion=0, int flag=0, int border=0, PyObject userData=None) -> wx.SizerItem Adds a new item to the begining of the list of sizer items managed by this sizer. See `Add` for a description of the parameters. |
PrependItem(*args, **kwargs)PrependItem(self, SizerItem item) Prepends a `wx.SizerItem` to the sizer. |
PrependSizer(self, *args, **kw)Compatibility alias for `Prepend`. |
PrependSpacer(self, *args, **kw)Compatibility alias for `Prepend`. |
PrependWindow(self, *args, **kw)Compatibility alias for `Prepend`. |
RecalcSizes(self)Using the sizes calculated by `CalcMin` reposition and resize all the items managed by this sizer. You should not need to call this directly as it is called by `Layout`. |
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 `Layout` to update the layout on screen after removing a child from the sizer. The *item* parameter can be either a window, a sizer, or the zero-based index of an item to remove. Returns True if the child item was found and removed.
|
RemovePos(self, *args, **kw)Compatibility alias for `Remove`. |
RemoveSizer(self, *args, **kw)Compatibility alias for `Remove`. |
RemoveWindow(self, *args, **kw)Compatibility alias for `Remove`. |
SetDimension(*args, **kwargs)SetDimension(self, int x, int y, int width, int 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 `Add`, `Insert` or `Prepend` methods. |
SetItemMinSize(self, item, *args)SetItemMinSize(self, item, Size 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(*args, **kwargs)SetMinSize(self, Size 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 `GetMinSize` will return either the minimal size as requested by its children or the minimal size set here, depending on which is bigger. |
SetSizeHints(*args, **kwargs)SetSizeHints(self, Window window) Tell the sizer to set (and `Fit`) the minimal size of the *window* to match the sizer's minimal size. This is commonly done in the constructor of the window itself if the window is resizable (as are many dialogs under Unix and frames on probably all platforms) in order to prevent the window from being sized smaller than the minimal size required by the sizer. |
SetVirtualSizeHints(*args, **kwargs)SetVirtualSizeHints(self, Window 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. :see: `wx.ScrolledWindow.SetScrollbars` |
Show(*args, **kwargs)Show(self, item, bool show=True, bool recursive=false) -> bool Shows or hides an item managed by the sizer. To make a sizer item disappear or reappear, use Show followed by `Layout`. The *item* parameter can be either a window, a sizer, or the zero-based index of the item. Use the recursive parameter to show or hide an item in a subsizer. Returns True if the item was found. |
ShowItems(*args, **kwargs)ShowItems(self, bool show) Recursively call `wx.SizerItem.Show` on all sizer items. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sat Apr 1 12:40:13 2006 | http://epydoc.sf.net |