Wxpython Control Learning: WX. boxsizer

Source: Internet
Author: User
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()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.