X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96de41c2c53c013293d452e3af55dd9c76e7030a..30e24d9dd5a5abf1c9a375ea259eb239b122b7f7:/wxPython/demo/RowColSizer.py?ds=inline diff --git a/wxPython/demo/RowColSizer.py b/wxPython/demo/RowColSizer.py index 433a7aac6e..d1fb3f56f8 100644 --- a/wxPython/demo/RowColSizer.py +++ b/wxPython/demo/RowColSizer.py @@ -1,45 +1,67 @@ -from wxPython.wx import * -from wxPython.lib.rcsizer import RowColSizer - +import wx +import wx.lib.rcsizer as rcs #---------------------------------------------------------------------- -class TestPanel(wxPanel): +class TestPanel(wx.Panel): def __init__(self, parent): - wxPanel.__init__(self, parent, -1) - - sizer = RowColSizer() - text = "This sizer lays out it's items by row and column that are"\ - "specified explicitly when the item is added to the sizer.\n"\ - "Grid cells with nothing in them are supported and column-"\ - "or row-spanning is handled as well. Growable rows and\n"\ - "columns are specified just like the wxFlexGridSizer." - sizer.Add(wxStaticText(self, -1, text), row=1, col=1, colspan=5) - - sizer.Add(wxTextCtrl(self, -1, "(3,1)"), flag=wxEXPAND, row=3, col=1) - sizer.Add(wxTextCtrl(self, -1, "(3,2)"), row=3, col=2) - sizer.Add(wxTextCtrl(self, -1, "(3,3)"), row=3, col=3) - sizer.Add(wxTextCtrl(self, -1, "(3,4)"), row=3, col=4) - sizer.Add(wxTextCtrl(self, -1, "(4,2) span:(2,2)"), flag=wxEXPAND, - row=4, col=2, rowspan=2, colspan=2) - sizer.Add(wxTextCtrl(self, -1, "(6,4)"), row=6, col=4) - sizer.Add(wxTextCtrl(self, -1, "(7,2)"), row=7, col=2) - sizer.Add(wxTextCtrl(self, -1, "(8,3)"), row=8, col=3) - sizer.Add(wxTextCtrl(self, -1, "(10,1) colspan: 4"), flag=wxEXPAND, pos=(10,1), colspan=4) - sizer.Add(wxTextCtrl(self, -1, "(3,5) rowspan: 8, growable col", style=wxTE_MULTILINE), - flag=wxEXPAND, pos=(3,5), size=(8,1)) - - box = wxBoxSizer(wxVERTICAL) - box.Add(wxButton(self, -1, "A vertical box"), flag=wxEXPAND) - box.Add(wxButton(self, -1, "sizer put in the"), flag=wxEXPAND) - box.Add(wxButton(self, -1, "RowColSizer at (12,1)"), flag=wxEXPAND) + wx.Panel.__init__(self, parent, -1) + + sizer = rcs.RowColSizer() + + text = "This sizer lays out it's items by row and column "\ + "that are specified explicitly when the item is \n"\ + "added to the sizer. Grid cells with nothing in "\ + "them are supported and column- or row-spanning is \n"\ + "handled as well. Growable rows and columns are "\ + "specified just like the wxFlexGridSizer." + + sizer.Add(wx.StaticText(self, -1, text), row=1, col=1, colspan=5) + + sizer.Add(wx.TextCtrl(self, -1, "(3,1)"), flag=wx.EXPAND, row=3, col=1) + sizer.Add(wx.TextCtrl(self, -1, "(3,2)"), row=3, col=2) + sizer.Add(wx.TextCtrl(self, -1, "(3,3)"), row=3, col=3) + sizer.Add(wx.TextCtrl(self, -1, "(3,4)"), row=3, col=4) + sizer.Add( + wx.TextCtrl(self, -1, "(4,2) span:(2,2)"), + flag=wx.EXPAND, row=4, col=2, rowspan=2, colspan=2 + ) + + sizer.Add(wx.TextCtrl(self, -1, "(6,4)"), row=6, col=4) + sizer.Add(wx.TextCtrl(self, -1, "(7,2)"), row=7, col=2) + sizer.Add(wx.TextCtrl(self, -1, "(8,3)"), row=8, col=3) + sizer.Add( + wx.TextCtrl(self, -1, "(10,1) colspan: 4"), + flag=wx.EXPAND, pos=(10,1), colspan=4 + ) + + sizer.Add( + wx.TextCtrl(self, -1, "(3,5) rowspan: 8, growable col", style=wx.TE_MULTILINE), + flag=wx.EXPAND, pos=(3,5), size=(8,1) + ) + + box = wx.BoxSizer(wx.VERTICAL) + box.Add(wx.Button(self, -1, "A vertical box"), flag=wx.EXPAND) + box.Add(wx.Button(self, -1, "sizer put in the"), flag=wx.EXPAND) + box.Add(wx.Button(self, -1, "RowColSizer at (12,1)"), flag=wx.EXPAND) sizer.Add(box, pos=(12,1)) - sizer.Add(wxTextCtrl(self, -1, "(12,2) align bottom"), flag=wxALIGN_BOTTOM, pos=(12,2)) - sizer.Add(wxTextCtrl(self, -1, "(12,3) align center"), flag=wxALIGN_CENTER_VERTICAL, pos=(12,3)) - sizer.Add(wxTextCtrl(self, -1, "(12,4)"),pos=(12,4)) - sizer.Add(wxTextCtrl(self, -1, "(12,5) full border"), flag=wxEXPAND|wxALL, border=15, pos=(12,5)) + sizer.Add( + wx.TextCtrl(self, -1, "(12,2) align bottom"), + flag=wx.ALIGN_BOTTOM, pos=(12,2) + ) + + sizer.Add( + wx.TextCtrl(self, -1, "(12,3) align center"), + flag=wx.ALIGN_CENTER_VERTICAL, pos=(12,3) + ) + + sizer.Add(wx.TextCtrl(self, -1, "(12,4)"),pos=(12,4)) + sizer.Add( + wx.TextCtrl(self, -1, "(12,5) full border"), + flag=wx.EXPAND|wx.ALL, border=15, pos=(12,5) + ) sizer.AddGrowableCol(5) sizer.AddGrowableRow(9) @@ -48,7 +70,7 @@ class TestPanel(wxPanel): sizer.AddSpacer(10,10, pos=(13,1)) self.SetSizer(sizer) - self.SetAutoLayout(true) + self.SetAutoLayout(True) #---------------------------------------------------------------------- @@ -61,7 +83,10 @@ def runTest(frame, nb, log): #---------------------------------------------------------------------- -import wxPython.lib.rcsizer -overview = wxPython.lib.rcsizer.__doc__ +overview = rcs.__doc__ +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])