Wx. boxsizer:
1. constructor boxsizer = wx. boxsizer (integer Orient) Orient can be wx. Vertical or WX. Horizontal
2. Add a control to sizer. Box. Add (wx. Window window, integer proportion = 0, integer flag = 0, integer border = 0)
Main parameters:
1. proportion: The proportion parameter defines the proportion of the space occupied by the component in the established direction, which is relative to other components.
2、flag:
Common flag parameters:
Adjust the flag of the method:
Wx. align_left
Wx. align_right
Wx. align_top
Wx. align_bottom
Wx. align_center_vertical
Wx. align_center_horizontal
Wx. align_center
- Wx. Top, wx. Bottom, wx. Left, wx. Right, wx. All
#-------------------------------------------------------------------------------# Name: 1# Purpose:## Author: ankier## Created: 13/09/2012# Copyright: (c) ankier 2012# Licence: <your licence>#-------------------------------------------------------------------------------import wxclass Border(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size =(800,600)) pane = wx.Panel(self, -1, size =(800,600)) pane.SetBackgroundColour('yellow') boxsizer = wx.BoxSizer(wx.HORIZONTAL) btn1 = wx.Button(pane, -1, 'Botton1') btn2 = wx.Button(pane, -1, 'Botton2') btn3 = wx.Button(pane, -1, 'Botton3') boxsizer.Add(btn1, proportion=0, flag=wx.ALL, border=2) boxsizer.Add(btn2, proportion=1, flag=wx.ALL, border=2) boxsizer.Add(btn3, proportion=2, flag=wx.ALL, border=2) self.SetSizer(boxsizer) self.Centre() self.Show(True)def main(): app = wx.App() Border(None, -1, '') app.MainLoop()if __name__ == '__main__': main()