| 1 | from wxPython.wx import * |
| 2 | from wxPython.lib.grids import wxFlexGridSizer |
| 3 | |
| 4 | class aFrame(wxFrame): |
| 5 | def __init__(self, parent=NULL, id=-1, title="test"): |
| 6 | wxFrame.__init__(self, parent, id, title) |
| 7 | s =wxBoxSizer(wxVERTICAL) |
| 8 | gs =wxFlexGridSizer(2, 2, 2, 2) |
| 9 | for label in ('one', 'two', 'tree', 'four'): |
| 10 | gs.Add(wxButton(self, -1, label, size=(100,100)), 1, wxEXPAND) |
| 11 | s.Add(gs, 1, wxEXPAND|wxALL, 50) |
| 12 | self.SetSizer(s) |
| 13 | self.SetAutoLayout(TRUE) |
| 14 | s.Fit(self) |
| 15 | |
| 16 | class MyApp(wxApp): |
| 17 | def OnInit(self): |
| 18 | frame =aFrame() |
| 19 | self.SetTopWindow(frame) |
| 20 | frame.Show(TRUE) |
| 21 | return TRUE |
| 22 | |
| 23 | app=MyApp(0) |
| 24 | app.MainLoop() |