import wx
+#----------------------------------------------------------------------
+
+class SampleWindow(wx.PyWindow):
+ """
+ A simple window that is used as sizer items in the tests below to
+ show how the various sizers work.
+ """
+ def __init__(self, parent, text, pos=wx.DefaultPosition, size=wx.DefaultSize):
+ wx.PyWindow.__init__(self, parent, -1,
+ #style=wx.RAISED_BORDER
+ #style=wx.SUNKEN_BORDER
+ style=wx.SIMPLE_BORDER
+ )
+ self.text = text
+ if size != wx.DefaultSize:
+ self.bestsize = size
+ else:
+ self.bestsize = (80,25)
+ self.SetSize(self.GetBestSize())
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+ self.Bind(wx.EVT_SIZE, self.OnSize)
+ self.Bind(wx.EVT_LEFT_UP, self.OnCloseParent)
+
+
+ def OnPaint(self, evt):
+ sz = self.GetSize()
+ dc = wx.PaintDC(self)
+ w,h = dc.GetTextExtent(self.text)
+ dc.Clear()
+ dc.DrawText(self.text, ((sz.width-w)/2, (sz.height-h)/2))
+
+ def OnSize(self, evt):
+ self.Refresh()
+
+ def OnCloseParent(self, evt):
+ p = wx.GetTopLevelParent(self)
+ if p:
+ p.Close()
+
+ def DoGetBestSize(self):
+ return self.bestsize
+
+
#----------------------------------------------------------------------
def makeSimpleBox1(win):
box = wx.BoxSizer(wx.HORIZONTAL)
- box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
return box
def makeSimpleBox2(win):
box = wx.BoxSizer(wx.VERTICAL)
- box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
return box
def makeSimpleBox3(win):
box = wx.BoxSizer(wx.HORIZONTAL)
- box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
return box
def makeSimpleBox4(win):
box = wx.BoxSizer(wx.HORIZONTAL)
- box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "three"), 1, wx.EXPAND)
- box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
- box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "four"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
return box
def makeSimpleBox5(win):
box = wx.BoxSizer(wx.HORIZONTAL)
- box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "three"), 3, wx.EXPAND)
- box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
- box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 3, wx.EXPAND)
+ box.Add(SampleWindow(win, "four"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
return box
def makeSimpleBox6(win):
box = wx.BoxSizer(wx.HORIZONTAL)
- box.Add(wx.Button(win, -1, "one"), 1, wx.ALIGN_TOP)
- box.Add(wx.Button(win, -1, "two"), 1, wx.EXPAND)
- box.Add(wx.Button(win, -1, "three"), 1, wx.ALIGN_CENTER)
- box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
- box.Add(wx.Button(win, -1, "five"), 1, wx.ALIGN_BOTTOM)
+ box.Add(SampleWindow(win, "one"), 1, wx.ALIGN_TOP)
+ box.Add(SampleWindow(win, "two"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 1, wx.ALIGN_CENTER)
+ box.Add(SampleWindow(win, "four"), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, "five"), 1, wx.ALIGN_BOTTOM)
return box
#----------------------------------------------------------------------
def makeSimpleBox7(win):
- box = wxBoxSizer(wxHORIZONTAL)
- box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
- box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
- box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
- box.Add((60, 20), 0, wxEXPAND)
- box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
+ box = wx.BoxSizer(wx.HORIZONTAL)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
+ box.Add((60, 20), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
return box
#----------------------------------------------------------------------
def makeSimpleBox8(win):
- box = wxBoxSizer(wxVERTICAL)
- box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
+ box = wx.BoxSizer(wx.VERTICAL)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
box.Add((0,0), 1)
- box.Add(wxButton(win, 1010, "two"), 0, wxALIGN_CENTER)
+ box.Add(SampleWindow(win, "two"), 0, wx.ALIGN_CENTER)
box.Add((0,0), 1)
- box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
- box.Add(wxButton(win, 1010, "four"), 0, wxEXPAND)
-# box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
+ box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
+# box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
return box
def makeSimpleBorder1(win):
bdr = wx.BoxSizer(wx.HORIZONTAL)
- btn = wx.Button(win, -1, "border")
+ btn = SampleWindow(win, "border")
btn.SetSize((80, 80))
bdr.Add(btn, 1, wx.EXPAND|wx.ALL, 15)
def makeSimpleBorder2(win):
bdr = wx.BoxSizer(wx.HORIZONTAL)
- btn = wx.Button(win, -1, "border")
+ btn = SampleWindow(win, "border")
btn.SetSize((80, 80))
bdr.Add(btn, 1, wx.EXPAND | wx.EAST | wx.WEST, 15)
def makeSimpleBorder3(win):
bdr = wx.BoxSizer(wx.HORIZONTAL)
- btn = wx.Button(win, -1, "border")
+ btn = SampleWindow(win, "border")
btn.SetSize((80, 80))
bdr.Add(btn, 1, wx.EXPAND | wx.NORTH | wx.WEST, 15)
def makeBoxInBox(win):
box = wx.BoxSizer(wx.VERTICAL)
- box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
box2 = wx.BoxSizer(wx.HORIZONTAL)
- box2.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
- btn3 = wx.Button(win, -1, "three")
+ box2.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ btn3 = SampleWindow(win, "three")
box2.Add(btn3, 0, wx.EXPAND)
- box2.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
- box2.Add(wx.Button(win, -1, "five"), 0, wx.EXPAND)
+ box2.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
+ box2.Add(SampleWindow(win, "five"), 0, wx.EXPAND)
box3 = wx.BoxSizer(wx.VERTICAL)
- box3.AddMany([ (wx.Button(win, -1, "six"), 0, wx.EXPAND),
- (wx.Button(win, -1, "seven"), 2, wx.EXPAND),
- (wx.Button(win, -1, "eight"), 1, wx.EXPAND),
- (wx.Button(win, -1, "nine"), 1, wx.EXPAND),
+ box3.AddMany([ (SampleWindow(win, "six"), 0, wx.EXPAND),
+ (SampleWindow(win, "seven"), 2, wx.EXPAND),
+ (SampleWindow(win, "eight"), 1, wx.EXPAND),
+ (SampleWindow(win, "nine"), 1, wx.EXPAND),
])
box2.Add(box3, 1, wx.EXPAND)
box.Add(box2, 1, wx.EXPAND)
- box.Add(wx.Button(win, -1, "ten"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "ten"), 0, wx.EXPAND)
##box.Hide(btn3)
insideBox = wx.BoxSizer(wx.HORIZONTAL)
box2 = wx.BoxSizer(wx.HORIZONTAL)
- box2.AddMany([ (wx.Button(win, -1, "one"), 0, wx.EXPAND),
- (wx.Button(win, -1, "two"), 0, wx.EXPAND),
- (wx.Button(win, -1, "three"), 0, wx.EXPAND),
- (wx.Button(win, -1, "four"), 0, wx.EXPAND),
- (wx.Button(win, -1, "five"), 0, wx.EXPAND),
+ box2.AddMany([ (SampleWindow(win, "one"), 0, wx.EXPAND),
+ (SampleWindow(win, "two"), 0, wx.EXPAND),
+ (SampleWindow(win, "three"), 0, wx.EXPAND),
+ (SampleWindow(win, "four"), 0, wx.EXPAND),
+ (SampleWindow(win, "five"), 0, wx.EXPAND),
])
insideBox.Add(box2, 0, wx.EXPAND)
bdr = wx.BoxSizer(wx.HORIZONTAL)
- bdr.Add(wx.Button(win, -1, "border"), 1, wx.EXPAND | wx.ALL)
+ bdr.Add(SampleWindow(win, "border"), 1, wx.EXPAND | wx.ALL)
insideBox.Add(bdr, 1, wx.EXPAND | wx.ALL, 20)
box3 = wx.BoxSizer(wx.VERTICAL)
- box3.AddMany([ (wx.Button(win, -1, "six"), 0, wx.EXPAND),
- (wx.Button(win, -1, "seven"), 2, wx.EXPAND),
- (wx.Button(win, -1, "eight"), 1, wx.EXPAND),
- (wx.Button(win, -1, "nine"), 1, wx.EXPAND),
+ box3.AddMany([ (SampleWindow(win, "six"), 0, wx.EXPAND),
+ (SampleWindow(win, "seven"), 2, wx.EXPAND),
+ (SampleWindow(win, "eight"), 1, wx.EXPAND),
+ (SampleWindow(win, "nine"), 1, wx.EXPAND),
])
insideBox.Add(box3, 1, wx.EXPAND)
outsideBox = wx.BoxSizer(wx.VERTICAL)
- outsideBox.Add(wx.Button(win, -1, "top"), 0, wx.EXPAND)
+ outsideBox.Add(SampleWindow(win, "top"), 0, wx.EXPAND)
outsideBox.Add(insideBox, 1, wx.EXPAND)
- outsideBox.Add(wx.Button(win, -1, "bottom"), 0, wx.EXPAND)
+ outsideBox.Add(SampleWindow(win, "bottom"), 0, wx.EXPAND)
return outsideBox
def makeGrid1(win):
gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
- gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'two'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'three'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'four'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'five'), 0, wx.EXPAND),
+ gs.AddMany([ (SampleWindow(win, 'one'), 0, wx.EXPAND),
+ (SampleWindow(win, 'two'), 0, wx.EXPAND),
+ (SampleWindow(win, 'three'), 0, wx.EXPAND),
+ (SampleWindow(win, 'four'), 0, wx.EXPAND),
+ (SampleWindow(win, 'five'), 0, wx.EXPAND),
#(75, 50),
- (wx.Button(win, -1, 'six'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'seven'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'nine'), 0, wx.EXPAND),
+ (SampleWindow(win, 'six'), 0, wx.EXPAND),
+ (SampleWindow(win, 'seven'), 0, wx.EXPAND),
+ (SampleWindow(win, 'eight'), 0, wx.EXPAND),
+ (SampleWindow(win, 'nine'), 0, wx.EXPAND),
])
return gs
gs = wx.GridSizer(3, 3) # rows, cols, hgap, vgap
box = wx.BoxSizer(wx.VERTICAL)
- box.Add(wx.Button(win, -1, 'A'), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, 'B'), 1, wx.EXPAND)
+ box.Add(SampleWindow(win, 'A'), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, 'B'), 1, wx.EXPAND)
gs2 = wx.GridSizer(2,2, 4, 4)
- gs2.AddMany([ (wx.Button(win, -1, 'C'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'E'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'F'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'G'), 0, wx.EXPAND)])
-
- gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM),
- (wx.Button(win, -1, 'two'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'three'), 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM),
- (wx.Button(win, -1, 'four'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'five'), 0, wx.ALIGN_CENTER),
- (wx.Button(win, -1, 'six'), 0, wx.EXPAND),
+ gs2.AddMany([ (SampleWindow(win, 'C'), 0, wx.EXPAND),
+ (SampleWindow(win, 'E'), 0, wx.EXPAND),
+ (SampleWindow(win, 'F'), 0, wx.EXPAND),
+ (SampleWindow(win, 'G'), 0, wx.EXPAND)])
+
+ gs.AddMany([ (SampleWindow(win, 'one'), 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM),
+ (SampleWindow(win, 'two'), 0, wx.EXPAND),
+ (SampleWindow(win, 'three'), 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM),
+ (SampleWindow(win, 'four'), 0, wx.EXPAND),
+ (SampleWindow(win, 'five'), 0, wx.ALIGN_CENTER),
+ (SampleWindow(win, 'six'), 0, wx.EXPAND),
(box, 0, wx.EXPAND | wx.ALL, 10),
- (wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
+ (SampleWindow(win, 'eight'), 0, wx.EXPAND),
(gs2, 0, wx.EXPAND | wx.ALL, 4),
])
def makeGrid3(win):
gs = wx.FlexGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
- gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'two'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'three'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'four'), 0, wx.EXPAND),
- #(wxButton(win, 1010, 'five'), 0, wxEXPAND),
+ gs.AddMany([ (SampleWindow(win, 'one'), 0, wx.EXPAND),
+ (SampleWindow(win, 'two'), 0, wx.EXPAND),
+ (SampleWindow(win, 'three'), 0, wx.EXPAND),
+ (SampleWindow(win, 'four'), 0, wx.EXPAND),
+ #(SampleWindow(win, 'five'), 0, wx.EXPAND),
((175, 50)),
- (wx.Button(win, -1, 'six'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'seven'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
- (wx.Button(win, -1, 'nine'), 0, wx.EXPAND),
+ (SampleWindow(win, 'six'), 0, wx.EXPAND),
+ (SampleWindow(win, 'seven'), 0, wx.EXPAND),
+ (SampleWindow(win, 'eight'), 0, wx.EXPAND),
+ (SampleWindow(win, 'nine'), 0, wx.EXPAND),
])
gs.AddGrowableRow(0)
bsize = wx.Size(100, 50)
gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
- gs.AddMany([ (wx.Button(win, -1, 'one', bpos, bsize),
+ gs.AddMany([ (SampleWindow(win, 'one', bpos, bsize),
0, wx.ALIGN_TOP | wx.ALIGN_LEFT ),
- (wx.Button(win, -1, 'two', bpos, bsize),
+ (SampleWindow(win, 'two', bpos, bsize),
0, wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL ),
- (wx.Button(win, -1, 'three', bpos, bsize),
+ (SampleWindow(win, 'three', bpos, bsize),
0, wx.ALIGN_TOP | wx.ALIGN_RIGHT ),
- (wx.Button(win, -1, 'four', bpos, bsize),
+ (SampleWindow(win, 'four', bpos, bsize),
0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT ),
- (wx.Button(win, -1, 'five', bpos, bsize),
+ (SampleWindow(win, 'five', bpos, bsize),
0, wx.ALIGN_CENTER ),
- (wx.Button(win, -1, 'six', bpos, bsize),
+ (SampleWindow(win, 'six', bpos, bsize),
0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT ),
- (wx.Button(win, -1, 'seven', bpos, bsize),
+ (SampleWindow(win, 'seven', bpos, bsize),
0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT ),
- (wx.Button(win, -1, 'eight', bpos, bsize),
+ (SampleWindow(win, 'eight', bpos, bsize),
0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL ),
- (wx.Button(win, -1, 'nine', bpos, bsize),
+ (SampleWindow(win, 'nine', bpos, bsize),
0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT ),
])
bsize = wx.Size(100, 50)
gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
- gs.AddMany([ (wx.Button(win, -1, 'one', bpos, bsize),
+ gs.AddMany([ (SampleWindow(win, 'one', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_LEFT ),
- (wx.Button(win, -1, 'two', bpos, bsize),
+ (SampleWindow(win, 'two', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL ),
- (wx.Button(win, -1, 'three', bpos, bsize),
+ (SampleWindow(win, 'three', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_RIGHT ),
- (wx.Button(win, -1, 'four', bpos, bsize),
+ (SampleWindow(win, 'four', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT ),
- (wx.Button(win, -1, 'five', bpos, bsize),
+ (SampleWindow(win, 'five', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_CENTER ),
- (wx.Button(win, -1, 'six', bpos, bsize),
+ (SampleWindow(win, 'six', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT ),
- (wx.Button(win, -1, 'seven', bpos, bsize),
+ (SampleWindow(win, 'seven', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT ),
- (wx.Button(win, -1, 'eight', bpos, bsize),
+ (SampleWindow(win, 'eight', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL ),
- (wx.Button(win, -1, 'nine', bpos, bsize),
+ (SampleWindow(win, 'nine', bpos, bsize),
0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT ),
])
def makeSimpleBoxShaped(win):
box = wx.BoxSizer(wx.HORIZONTAL)
- box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
- box.Add(wx.Button(win, -1, "five"), 1, wx.SHAPED)
+ box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
+ box.Add(SampleWindow(win, "five"), 1, wx.SHAPED)
return box
("", None, ""),
("Simple Grid", makeGrid1,
- "This is an example of the wxGridSizer. In this case all row heights "
+ "This is an example of the wx.GridSizer. In this case all row heights "
"and column widths are kept the same as all the others and all items "
"fill their available space. The horizontal and vertical gaps are set to "
"2 pixels each."
),
("More Grid Features", makeGrid2,
- "This is another example of the wxGridSizer. This one has no gaps in the grid, "
+ "This is another example of the wx.GridSizer. This one has no gaps in the grid, "
"but various cells are given different alignment options and some of them "
"hold nested sizers."
),
("Proportional resize", makeSimpleBoxShaped,
"Managed items can preserve their original aspect ratio. The last item has the "
- "wxSHAPED flag set and will resize proportional to its original size."
+ "wx.SHAPED flag set and will resize proportional to its original size."
),
("Proportional resize with Alignments", makeShapes,
class TestFrame(wx.Frame):
def __init__(self, parent, title, sizerFunc):
wx.Frame.__init__(self, parent, -1, title)
- self.Bind(wx.EVT_BUTTON, self.OnButton)
p = wx.Panel(self, -1)
self.SetStatusText("Resize this frame to see how the sizers respond...")
self.sizer.Fit(p)
- p.SetAutoLayout(True)
p.SetSizer(self.sizer)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.Fit()
self.MakeModal(False)
self.Destroy()
- def OnButton(self, event):
- self.Close(True)
#----------------------------------------------------------------------
return win
overview = ""
-#wxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \
-#wxBoxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \
-#wxBorderSizer.__doc__
#----------------------------------------------------------------------