FT,border = 5 )
#
proportion=2 代表当容器大小变化时,text_filename控件的大小变化,变化速度为2
bsizer_center.Add(self.text_filename,proportion=2,flag=wx.EXPAND|wx.ALL,border=5)
bsizer_center.Add(self.bt_open,proportion=1,flag=wx.ALL,border=5)
bsizer_center.Add(self.bt_save,proportion=0,flag=wx.ALL,border=5)
bsizer_bottom.Add(self.text_contents,proportion=1 ,flag = wx.EXPAND|wx.ALL,border =5 )
#
wx.VERTICAL 横向分割
bsizer_all = wx.BoxSizer(wx.VERTICAL)
#
添加顶部sizer,proportion=0 代表bsizer_top大小不可变化
bsizer_all.Add(bsizer_top,proportion=0,flag=wx.EXPAND|wx.ALL,border=5)
bsizer_all.Add(bsizer_center,proportion=0,flag=wx.EXPAND|wx.ALL,border=5)
#
添加顶部sizer,proportion=1 代表bsizer_bottom大小变化
bsizer_all.Add(bsizer_bottom,proportion=1,flag=wx.EXPAND|wx.ALL,border=5)
self.Bind(wx.EVT_BUTTON,self.onOpen,self.bt_open)
#
self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
panel.SetSizer(bsizer_all)
def onOpen(self,event):
self.text_contents.AppendText(str(self.GetSizeTuple()))
self.text_contents.AppendText(str(self.bt_open.GetSizeTuple()))
self.text_contents.AppendText(str(self.text_filename.GetSizeTuple()))
self.SetSize((700,600))
self.text_contents.AppendText(str(self.GetSizeTuple()))
self.text_contents.AppendText(str(self.bt_open.GetSizeTuple()))
self.text_contents.AppendText(str(self.text_filename.GetSizeTuple()))
if
__name__ ==
'
__main__
':
app = wx.PySimpleApp()
frame = MyFrame(parent = None, id = -1)
frame.Show()
frame.Center()
app.MainLoop()
3、总结
1、Box = wx.BoxSizer(integer orie |