X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5448935a303a319f34791e7f169beee9fc3ba802..34d71f81f4810c55092005c113039a8857422185:/wxPython/demo/SizedControls.py diff --git a/wxPython/demo/SizedControls.py b/wxPython/demo/SizedControls.py index 77f89ea680..63b237a3e7 100644 --- a/wxPython/demo/SizedControls.py +++ b/wxPython/demo/SizedControls.py @@ -1,6 +1,131 @@ import wx import wxaddons.sized_controls as sc +overview = """\ +
Since controls are added to the parent's sizer upon creation, you +don't need to use sizer.Add or even create sizers yourself. You just +use SetSizerType() to change the sizer you want to use, and +control.SetSizerProps() to change the sizer properties of the +control. So as a result, code that used to look like this: + +
+... wx.Dialog init code... + +panel = wx.Panel(self, -1) +b1 = wx.Button(panel, -1) +b2 = wx.Button(panel, -1) +t1 = wx.TextCtrl(panel, -1) +b3 = wx.Button(panel, -1) + +sizer = wx.BoxSizer(wx.HORIZONTAL) +sizer.Add(b1, 0, wx.ALL, 6) +sizer.Add(b2, 0, wx.ALL, 6) +sizer.Add(t1, 0, wx.EXPAND | wx.ALL, 6) +sizer.Add(b3, 0, wx.ALL, 6) +panel.SetSizer(sizer) + +dlgSizer = wx.BoxSizer() +dlgSizer.Add(panel, 1, wx.EXPAND) +self.SetSizer(dlgSizer) +self.SetAutoLayout(True) + +... rest of dialog ...+ |
+... wx.Dialog init code... + +panel = self.GetContentsPane() +panel.SetSizerType(\"horizontal\") + +b1 = wx.Button(panel, -1) +b2 = wx.Button(panel, -1) + +t1 = wx.TextCtrl(panel, -1) +t1.SetSizerProps(expand=True) + +b3 = wx.Button(panel, -1) + +... rest of dialog ...+ |
wx.Window.SetSizerProps(<props>)+ +
+
Parameter | Values | Summary | +
expand | True/False | +Whether or not the control should grow to fill free space if +free space is available. | +
proportion | Number (typically 0-10) | +How much of the free space the control should take up. Note that this value is +relative to other controls, so a proportion of 2 means take up +'twice as much' space as controls with a proportion of 1. | +
halign | "left", "center", "centre", "right" | +Determines horizontal alignment of control. | +
valign | "top", "center", "centre", "bottom" | +Determines vertical alignment of control. | +
border | Tuple: ([dirs], integer) | +Specifies amount of border padding to apply to specified directions. +Example: (["left", "right"], 6) would add six pixels to left and right borders. +Note that, unfortunately, +it is not currently possible to assign different border sizes to each direction. | +
minsize | One of the following string values: "fixed", "adjust" | +Determines whether or not the minsize can be updated when the control's best size changes. | +