标签:
#coding:utf-8 import wx labels=‘1 2 3 4 5 6 7 8 9 ‘.split() class TestFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,‘grid sizer‘) panel=wx.Panel(self,-1) sizer=wx.GridBagSizer(hgap=5,vgap=5) for col in range(3): for row in range(3): button=wx.Button(panel,label=labels[row*3+col]) sizer.Add(button,pos=(row,col)) #跨行 bt=wx.Button(panel,label=‘sapn 3 rows‘) sizer.Add(bt,pos=(0,3),span=(3,1),flag=wx.EXPAND) #跨列 bt=wx.Button(panel,label=‘span all columns‘) sizer.Add(bt,pos=(3,0),span=(1,4),flag=wx.EXPAND) #使最后的行和列可增长 sizer.AddGrowableCol(3) sizer.AddGrowableRow(3) panel.SetSizer(sizer) sizer.Fit(self) app=wx.App(False) TestFrame().Show() app.MainLoop()
标签:
原文地址:http://www.cnblogs.com/memery/p/4251441.html