The sized controls default HIG compliant sizers under the hood and provides a simple interface for customizing those sizers.
The following sized controls exist:
SizedFrame
SizedDialog
SizedPanel
SizedScrolledPanel
:class SizedStaticBox
The sized controls allow you to create sizer based layouts without having to code the sizers by hand, but still provide you the manual detailed control of the sizer and sizer items if necessary.
Sample usage:
import wx
import wx.lib.sized_controls as sc
app = wx.App(0)
frame = sc.SizedFrame(None, -1, "A sized frame")
pane = frame.GetContentsPane()
pane.SetSizerType("horizontal")
b1 = wx.Button(pane, wx.ID_ANY)
t1 = wx.TextCtrl(pane, -1)
t1.SetSizerProps(expand=True)
frame.Show()
app.MainLoop()
Return the platform specific default border. |
|
Default panel border is set to 0 by default as the child control |
|
Get the platform specific dialog border. |
|
Get the horizontal grow value. |
|
Returns a dictionary of prop name + value. |
|
Get the vertical grow value. |
|
Set default sizer properties. |
|
Set horizontal grow proportion. |
|
Sets a sizer property |
|
Allows to set multiple sizer properties |
|
Set vertical grow proportion. |
A sized dialog |
|
A sized frame. |
|
A sized panel. |
|
Mixin class for some methods used by the |
|
A sized scrolled panel. |
|
StaticBox() |
GetDefaultBorder
(self)¶Return the platform specific default border.
int
GetDefaultPanelBorder
(self)¶Default panel border is set to 0 by default as the child control will set their borders.
GetDialogBorder
(self)¶Get the platform specific dialog border.
int
GetHGrow
(self)¶Get the horizontal grow value.
int
GetSizerProps
(self)¶Returns a dictionary of prop name + value.
GetVGrow
(self)¶Get the vertical grow value.
int
SetDefaultSizerProps
(self)¶Set default sizer properties.
SetHGrow
(self, proportion)¶Set horizontal grow proportion.
proportion (int) – proportion to use
SetSizerProp
(self, prop, value)¶Sets a sizer property
Sample usages:
control.SetSizerProp('expand', True)
prop (string) – valid strings are “proportion”, “hgrow”, “vgrow”, “align”, “halign”, “valign”, “border”, “minsize” and “expand”
value – corresponding value for the prop
SetSizerProps
(self, props={}, **kwargs)¶Allows to set multiple sizer properties
Sample usages:
control.SetSizerProps(expand=True, proportion=1)
control.SetSizerProps(expand=True, valign='center', border=(['top',
'bottom'], 5))
control.SetSizerProps({'growable_row': (1, 1),
'growable_col': (0, 1),})
props (dict) – a dictionary of prop name + value
kwargs – keywords can be used for properties, e.g. expand=True
SetVGrow
(self, proportion)¶Set vertical grow proportion.
proportion (int) – proportion to use