2 from blockwindow
import BlockWindow
4 labels
= "one two three four".split()
6 class TestFrame(wx
.Frame
):
9 wx
.Frame
.__init
__(self
, None, -1, self
.title
)
10 sizer
= self
.CreateSizerAndWindows()
14 class VBoxSizerFrame(TestFrame
):
15 title
= "Vertical BoxSizer"
17 def CreateSizerAndWindows(self
):
18 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
20 bw
= BlockWindow(self
, label
=label
, size
=(200,30))
21 sizer
.Add(bw
, flag
=wx
.EXPAND
)
25 class HBoxSizerFrame(TestFrame
):
26 title
= "Horizontal BoxSizer"
28 def CreateSizerAndWindows(self
):
29 sizer
= wx
.BoxSizer(wx
.HORIZONTAL
)
31 bw
= BlockWindow(self
, label
=label
, size
=(75,30))
32 sizer
.Add(bw
, flag
=wx
.EXPAND
)
35 class VBoxSizerStretchableFrame(TestFrame
):
36 title
= "Stretchable BoxSizer"
38 def CreateSizerAndWindows(self
):
39 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
41 bw
= BlockWindow(self
, label
=label
, size
=(200,30))
42 sizer
.Add(bw
, flag
=wx
.EXPAND
)
44 # Add an item that takes all the free space
45 bw
= BlockWindow(self
, label
="gets all free space", size
=(200,30))
46 sizer
.Add(bw
, 1, flag
=wx
.EXPAND
)
49 class VBoxSizerMultiProportionalFrame(TestFrame
):
50 title
= "Proportional BoxSizer"
52 def CreateSizerAndWindows(self
):
53 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
55 bw
= BlockWindow(self
, label
=label
, size
=(200,30))
56 sizer
.Add(bw
, flag
=wx
.EXPAND
)
58 # Add an item that takes one share of the free space
59 bw
= BlockWindow(self
,
60 label
="gets 1/3 of the free space",
62 sizer
.Add(bw
, 1, flag
=wx
.EXPAND
)
64 # Add an item that takes 2 shares of the free space
65 bw
= BlockWindow(self
,
66 label
="gets 2/3 of the free space",
68 sizer
.Add(bw
, 2, flag
=wx
.EXPAND
)
71 app
= wx
.PySimpleApp()
72 frameList
= [VBoxSizerFrame
, HBoxSizerFrame
,
73 VBoxSizerStretchableFrame
,
74 VBoxSizerMultiProportionalFrame
]
75 for klass
in frameList
: