1 # 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Had to do a bit of rework for the demo; there was no panel attached
4 # to the demo window, so all buttons were showing as dark gray on
5 # dark gray. I have no idea why this didn't break before. Robin,
6 # please examine my changes to ensure you approve. It's rather
10 #----------------------------------------------------------------------
12 #----------------------------------------------------------------------
16 #----------------------------------------------------------------------
18 def makeSimpleBox1(win
):
19 box
= wx
.BoxSizer(wx
.HORIZONTAL
)
20 box
.Add(wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
)
21 box
.Add(wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
)
22 box
.Add(wx
.Button(win
, -1, "three"), 0, wx
.EXPAND
)
23 box
.Add(wx
.Button(win
, -1, "four"), 0, wx
.EXPAND
)
27 #----------------------------------------------------------------------
29 def makeSimpleBox2(win
):
30 box
= wx
.BoxSizer(wx
.VERTICAL
)
31 box
.Add(wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
)
32 box
.Add(wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
)
33 box
.Add(wx
.Button(win
, -1, "three"), 0, wx
.EXPAND
)
34 box
.Add(wx
.Button(win
, -1, "four"), 0, wx
.EXPAND
)
38 #----------------------------------------------------------------------
40 def makeSimpleBox3(win
):
41 box
= wx
.BoxSizer(wx
.HORIZONTAL
)
42 box
.Add(wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
)
43 box
.Add(wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
)
44 box
.Add(wx
.Button(win
, -1, "three"), 0, wx
.EXPAND
)
45 box
.Add(wx
.Button(win
, -1, "four"), 0, wx
.EXPAND
)
46 box
.Add(wx
.Button(win
, -1, "five"), 1, wx
.EXPAND
)
50 #----------------------------------------------------------------------
52 def makeSimpleBox4(win
):
53 box
= wx
.BoxSizer(wx
.HORIZONTAL
)
54 box
.Add(wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
)
55 box
.Add(wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
)
56 box
.Add(wx
.Button(win
, -1, "three"), 1, wx
.EXPAND
)
57 box
.Add(wx
.Button(win
, -1, "four"), 1, wx
.EXPAND
)
58 box
.Add(wx
.Button(win
, -1, "five"), 1, wx
.EXPAND
)
62 #----------------------------------------------------------------------
64 def makeSimpleBox5(win
):
65 box
= wx
.BoxSizer(wx
.HORIZONTAL
)
66 box
.Add(wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
)
67 box
.Add(wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
)
68 box
.Add(wx
.Button(win
, -1, "three"), 3, wx
.EXPAND
)
69 box
.Add(wx
.Button(win
, -1, "four"), 1, wx
.EXPAND
)
70 box
.Add(wx
.Button(win
, -1, "five"), 1, wx
.EXPAND
)
74 #----------------------------------------------------------------------
76 def makeSimpleBox6(win
):
77 box
= wx
.BoxSizer(wx
.HORIZONTAL
)
78 box
.Add(wx
.Button(win
, -1, "one"), 1, wx
.ALIGN_TOP
)
79 box
.Add(wx
.Button(win
, -1, "two"), 1, wx
.EXPAND
)
80 box
.Add(wx
.Button(win
, -1, "three"), 1, wx
.ALIGN_CENTER
)
81 box
.Add(wx
.Button(win
, -1, "four"), 1, wx
.EXPAND
)
82 box
.Add(wx
.Button(win
, -1, "five"), 1, wx
.ALIGN_BOTTOM
)
86 #----------------------------------------------------------------------
88 def makeSimpleBox7(win
):
89 box
= wx
.BoxSizer(wx
.HORIZONTAL
)
90 box
.Add(wx
.Button(win
, 1010, "one"), 0, wx
.EXPAND
)
91 box
.Add(wx
.Button(win
, 1010, "two"), 0, wx
.EXPAND
)
92 box
.Add(wx
.Button(win
, 1010, "three"), 0, wx
.EXPAND
)
93 box
.Add((60, 20), 0, wx
.EXPAND
)
94 box
.Add(wx
.Button(win
, 1010, "five"), 1, wx
.EXPAND
)
98 #----------------------------------------------------------------------
100 def makeSimpleBox8(win
):
101 box
= wx
.BoxSizer(wx
.VERTICAL
)
102 box
.Add(wx
.Button(win
, 1010, "one"), 0, wx
.EXPAND
)
104 box
.Add(wx
.Button(win
, 1010, "two"), 0, wx
.ALIGN_CENTER
)
106 box
.Add(wx
.Button(win
, 1010, "three"), 0, wx
.EXPAND
)
107 box
.Add(wx
.Button(win
, 1010, "four"), 0, wx
.EXPAND
)
108 # box.Add(wx.Button(win, 1010, "five"), 1, wx.EXPAND)
112 #----------------------------------------------------------------------
113 #----------------------------------------------------------------------
115 def makeSimpleBorder1(win
):
116 bdr
= wx
.BoxSizer(wx
.HORIZONTAL
)
117 btn
= wx
.Button(win
, -1, "border")
118 btn
.SetSize((80, 80))
119 bdr
.Add(btn
, 1, wx
.EXPAND|wx
.ALL
, 15)
123 #----------------------------------------------------------------------
125 def makeSimpleBorder2(win
):
126 bdr
= wx
.BoxSizer(wx
.HORIZONTAL
)
127 btn
= wx
.Button(win
, -1, "border")
128 btn
.SetSize((80, 80))
129 bdr
.Add(btn
, 1, wx
.EXPAND | wx
.EAST | wx
.WEST
, 15)
133 #----------------------------------------------------------------------
135 def makeSimpleBorder3(win
):
136 bdr
= wx
.BoxSizer(wx
.HORIZONTAL
)
137 btn
= wx
.Button(win
, -1, "border")
138 btn
.SetSize((80, 80))
139 bdr
.Add(btn
, 1, wx
.EXPAND | wx
.NORTH | wx
.WEST
, 15)
143 #----------------------------------------------------------------------
144 #----------------------------------------------------------------------
146 def makeBoxInBox(win
):
147 box
= wx
.BoxSizer(wx
.VERTICAL
)
149 box
.Add(wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
)
151 box2
= wx
.BoxSizer(wx
.HORIZONTAL
)
152 box2
.Add(wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
)
153 btn3
= wx
.Button(win
, -1, "three")
154 box2
.Add(btn3
, 0, wx
.EXPAND
)
155 box2
.Add(wx
.Button(win
, -1, "four"), 0, wx
.EXPAND
)
156 box2
.Add(wx
.Button(win
, -1, "five"), 0, wx
.EXPAND
)
158 box3
= wx
.BoxSizer(wx
.VERTICAL
)
159 box3
.AddMany([ (wx
.Button(win
, -1, "six"), 0, wx
.EXPAND
),
160 (wx
.Button(win
, -1, "seven"), 2, wx
.EXPAND
),
161 (wx
.Button(win
, -1, "eight"), 1, wx
.EXPAND
),
162 (wx
.Button(win
, -1, "nine"), 1, wx
.EXPAND
),
165 box2
.Add(box3
, 1, wx
.EXPAND
)
166 box
.Add(box2
, 1, wx
.EXPAND
)
168 box
.Add(wx
.Button(win
, -1, "ten"), 0, wx
.EXPAND
)
174 #----------------------------------------------------------------------
176 def makeBoxInBorder(win
):
177 bdr
= wx
.BoxSizer(wx
.HORIZONTAL
)
178 box
= makeSimpleBox3(win
)
179 bdr
.Add(box
, 1, wx
.EXPAND | wx
.ALL
, 15)
183 #----------------------------------------------------------------------
185 def makeBorderInBox(win
):
186 insideBox
= wx
.BoxSizer(wx
.HORIZONTAL
)
188 box2
= wx
.BoxSizer(wx
.HORIZONTAL
)
189 box2
.AddMany([ (wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
),
190 (wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
),
191 (wx
.Button(win
, -1, "three"), 0, wx
.EXPAND
),
192 (wx
.Button(win
, -1, "four"), 0, wx
.EXPAND
),
193 (wx
.Button(win
, -1, "five"), 0, wx
.EXPAND
),
196 insideBox
.Add(box2
, 0, wx
.EXPAND
)
198 bdr
= wx
.BoxSizer(wx
.HORIZONTAL
)
199 bdr
.Add(wx
.Button(win
, -1, "border"), 1, wx
.EXPAND | wx
.ALL
)
200 insideBox
.Add(bdr
, 1, wx
.EXPAND | wx
.ALL
, 20)
202 box3
= wx
.BoxSizer(wx
.VERTICAL
)
203 box3
.AddMany([ (wx
.Button(win
, -1, "six"), 0, wx
.EXPAND
),
204 (wx
.Button(win
, -1, "seven"), 2, wx
.EXPAND
),
205 (wx
.Button(win
, -1, "eight"), 1, wx
.EXPAND
),
206 (wx
.Button(win
, -1, "nine"), 1, wx
.EXPAND
),
208 insideBox
.Add(box3
, 1, wx
.EXPAND
)
210 outsideBox
= wx
.BoxSizer(wx
.VERTICAL
)
211 outsideBox
.Add(wx
.Button(win
, -1, "top"), 0, wx
.EXPAND
)
212 outsideBox
.Add(insideBox
, 1, wx
.EXPAND
)
213 outsideBox
.Add(wx
.Button(win
, -1, "bottom"), 0, wx
.EXPAND
)
218 #----------------------------------------------------------------------
221 gs
= wx
.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
223 gs
.AddMany([ (wx
.Button(win
, -1, 'one'), 0, wx
.EXPAND
),
224 (wx
.Button(win
, -1, 'two'), 0, wx
.EXPAND
),
225 (wx
.Button(win
, -1, 'three'), 0, wx
.EXPAND
),
226 (wx
.Button(win
, -1, 'four'), 0, wx
.EXPAND
),
227 (wx
.Button(win
, -1, 'five'), 0, wx
.EXPAND
),
229 (wx
.Button(win
, -1, 'six'), 0, wx
.EXPAND
),
230 (wx
.Button(win
, -1, 'seven'), 0, wx
.EXPAND
),
231 (wx
.Button(win
, -1, 'eight'), 0, wx
.EXPAND
),
232 (wx
.Button(win
, -1, 'nine'), 0, wx
.EXPAND
),
237 #----------------------------------------------------------------------
240 gs
= wx
.GridSizer(3, 3) # rows, cols, hgap, vgap
242 box
= wx
.BoxSizer(wx
.VERTICAL
)
243 box
.Add(wx
.Button(win
, -1, 'A'), 0, wx
.EXPAND
)
244 box
.Add(wx
.Button(win
, -1, 'B'), 1, wx
.EXPAND
)
246 gs2
= wx
.GridSizer(2,2, 4, 4)
247 gs2
.AddMany([ (wx
.Button(win
, -1, 'C'), 0, wx
.EXPAND
),
248 (wx
.Button(win
, -1, 'E'), 0, wx
.EXPAND
),
249 (wx
.Button(win
, -1, 'F'), 0, wx
.EXPAND
),
250 (wx
.Button(win
, -1, 'G'), 0, wx
.EXPAND
)])
252 gs
.AddMany([ (wx
.Button(win
, -1, 'one'), 0, wx
.ALIGN_RIGHT | wx
.ALIGN_BOTTOM
),
253 (wx
.Button(win
, -1, 'two'), 0, wx
.EXPAND
),
254 (wx
.Button(win
, -1, 'three'), 0, wx
.ALIGN_LEFT | wx
.ALIGN_BOTTOM
),
255 (wx
.Button(win
, -1, 'four'), 0, wx
.EXPAND
),
256 (wx
.Button(win
, -1, 'five'), 0, wx
.ALIGN_CENTER
),
257 (wx
.Button(win
, -1, 'six'), 0, wx
.EXPAND
),
258 (box
, 0, wx
.EXPAND | wx
.ALL
, 10),
259 (wx
.Button(win
, -1, 'eight'), 0, wx
.EXPAND
),
260 (gs2
, 0, wx
.EXPAND | wx
.ALL
, 4),
265 #----------------------------------------------------------------------
268 gs
= wx
.FlexGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
270 gs
.AddMany([ (wx
.Button(win
, -1, 'one'), 0, wx
.EXPAND
),
271 (wx
.Button(win
, -1, 'two'), 0, wx
.EXPAND
),
272 (wx
.Button(win
, -1, 'three'), 0, wx
.EXPAND
),
273 (wx
.Button(win
, -1, 'four'), 0, wx
.EXPAND
),
274 #(wx.Button(win, 1010, 'five'), 0, wx.EXPAND),
276 (wx
.Button(win
, -1, 'six'), 0, wx
.EXPAND
),
277 (wx
.Button(win
, -1, 'seven'), 0, wx
.EXPAND
),
278 (wx
.Button(win
, -1, 'eight'), 0, wx
.EXPAND
),
279 (wx
.Button(win
, -1, 'nine'), 0, wx
.EXPAND
),
287 #----------------------------------------------------------------------
290 bpos
= wx
.DefaultPosition
291 bsize
= wx
.Size(100, 50)
292 gs
= wx
.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
294 gs
.AddMany([ (wx
.Button(win
, -1, 'one', bpos
, bsize
),
295 0, wx
.ALIGN_TOP | wx
.ALIGN_LEFT
),
296 (wx
.Button(win
, -1, 'two', bpos
, bsize
),
297 0, wx
.ALIGN_TOP | wx
.ALIGN_CENTER_HORIZONTAL
),
298 (wx
.Button(win
, -1, 'three', bpos
, bsize
),
299 0, wx
.ALIGN_TOP | wx
.ALIGN_RIGHT
),
300 (wx
.Button(win
, -1, 'four', bpos
, bsize
),
301 0, wx
.ALIGN_CENTER_VERTICAL | wx
.ALIGN_LEFT
),
302 (wx
.Button(win
, -1, 'five', bpos
, bsize
),
303 0, wx
.ALIGN_CENTER
),
304 (wx
.Button(win
, -1, 'six', bpos
, bsize
),
305 0, wx
.ALIGN_CENTER_VERTICAL | wx
.ALIGN_RIGHT
),
306 (wx
.Button(win
, -1, 'seven', bpos
, bsize
),
307 0, wx
.ALIGN_BOTTOM | wx
.ALIGN_LEFT
),
308 (wx
.Button(win
, -1, 'eight', bpos
, bsize
),
309 0, wx
.ALIGN_BOTTOM | wx
.ALIGN_CENTER_HORIZONTAL
),
310 (wx
.Button(win
, -1, 'nine', bpos
, bsize
),
311 0, wx
.ALIGN_BOTTOM | wx
.ALIGN_RIGHT
),
316 #----------------------------------------------------------------------
319 bpos
= wx
.DefaultPosition
320 bsize
= wx
.Size(100, 50)
321 gs
= wx
.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
323 gs
.AddMany([ (wx
.Button(win
, -1, 'one', bpos
, bsize
),
324 0, wx
.SHAPED | wx
.ALIGN_TOP | wx
.ALIGN_LEFT
),
325 (wx
.Button(win
, -1, 'two', bpos
, bsize
),
326 0, wx
.SHAPED | wx
.ALIGN_TOP | wx
.ALIGN_CENTER_HORIZONTAL
),
327 (wx
.Button(win
, -1, 'three', bpos
, bsize
),
328 0, wx
.SHAPED | wx
.ALIGN_TOP | wx
.ALIGN_RIGHT
),
329 (wx
.Button(win
, -1, 'four', bpos
, bsize
),
330 0, wx
.SHAPED | wx
.ALIGN_CENTER_VERTICAL | wx
.ALIGN_LEFT
),
331 (wx
.Button(win
, -1, 'five', bpos
, bsize
),
332 0, wx
.SHAPED | wx
.ALIGN_CENTER
),
333 (wx
.Button(win
, -1, 'six', bpos
, bsize
),
334 0, wx
.SHAPED | wx
.ALIGN_CENTER_VERTICAL | wx
.ALIGN_RIGHT
),
335 (wx
.Button(win
, -1, 'seven', bpos
, bsize
),
336 0, wx
.SHAPED | wx
.ALIGN_BOTTOM | wx
.ALIGN_LEFT
),
337 (wx
.Button(win
, -1, 'eight', bpos
, bsize
),
338 0, wx
.SHAPED | wx
.ALIGN_BOTTOM | wx
.ALIGN_CENTER_HORIZONTAL
),
339 (wx
.Button(win
, -1, 'nine', bpos
, bsize
),
340 0, wx
.SHAPED | wx
.ALIGN_BOTTOM | wx
.ALIGN_RIGHT
),
345 #----------------------------------------------------------------------
347 def makeSimpleBoxShaped(win
):
348 box
= wx
.BoxSizer(wx
.HORIZONTAL
)
349 box
.Add(wx
.Button(win
, -1, "one"), 0, wx
.EXPAND
)
350 box
.Add(wx
.Button(win
, -1, "two"), 0, wx
.EXPAND
)
351 box
.Add(wx
.Button(win
, -1, "three"), 0, wx
.EXPAND
)
352 box
.Add(wx
.Button(win
, -1, "four"), 0, wx
.EXPAND
)
353 box
.Add(wx
.Button(win
, -1, "five"), 1, wx
.SHAPED
)
357 #----------------------------------------------------------------------
360 ("Simple horizontal boxes", makeSimpleBox1
,
361 "This is a HORIZONTAL box sizer with four non-stretchable buttons held "
362 "within it. Notice that the buttons are added and aligned in the horizontal "
363 "dimension. Also notice that they are fixed size in the horizontal dimension, "
364 "but will stretch vertically."
367 ("Simple vertical boxes", makeSimpleBox2
,
368 "Exactly the same as the previous sample but using a VERTICAL box sizer "
369 "instead of a HORIZONTAL one."
372 ("Add a stretchable", makeSimpleBox3
,
373 "We've added one more button with the stretchable flag turned on. Notice "
374 "how it grows to fill the extra space in the otherwise fixed dimension."
377 ("More than one stretchable", makeSimpleBox4
,
378 "Here there are several items that are stretchable, they all divide up the "
379 "extra space evenly."
382 ("Weighting factor", makeSimpleBox5
,
383 "This one shows more than one stretchable, but one of them has a weighting "
384 "factor so it gets more of the free space."
387 ("Edge Affinity", makeSimpleBox6
,
388 "For items that don't completly fill their allotted space, and don't "
389 "stretch, you can specify which side (or the center) they should stay "
393 ("Spacer", makeSimpleBox7
,
394 "You can add empty space to be managed by a Sizer just as if it were a "
395 "window or another Sizer."
398 ("Centering in available space", makeSimpleBox8
,
399 "This one shows an item that does not expand to fill it's space, but rather"
400 "stays centered within it."
403 # ("Percent Sizer", makeSimpleBox6,
404 # "You can use the wx.BoxSizer like a Percent Sizer. Just make sure that all "
405 # "the weighting factors add up to 100!"
410 ("Simple border sizer", makeSimpleBorder1
,
411 "The wx.BoxSizer can leave empty space around its contents. This one "
412 "gives a border all the way around."
415 ("East and West border", makeSimpleBorder2
,
416 "You can pick and choose which sides have borders."
419 ("North and West border", makeSimpleBorder3
,
420 "You can pick and choose which sides have borders."
425 ("Boxes inside of boxes", makeBoxInBox
,
426 "This one shows nesting of boxes within boxes within boxes, using both "
427 "orientations. Notice also that button seven has a greater weighting "
428 "factor than its siblings."
431 ("Boxes inside a Border", makeBoxInBorder
,
432 "Sizers of different types can be nested within each other as well. "
433 "Here is a box sizer with several buttons embedded within a border sizer."
436 ("Border in a Box", makeBorderInBox
,
437 "Another nesting example. This one has Boxes and a Border inside another Box."
442 ("Simple Grid", makeGrid1
,
443 "This is an example of the wx.GridSizer. In this case all row heights "
444 "and column widths are kept the same as all the others and all items "
445 "fill their available space. The horizontal and vertical gaps are set to "
449 ("More Grid Features", makeGrid2
,
450 "This is another example of the wx.GridSizer. This one has no gaps in the grid, "
451 "but various cells are given different alignment options and some of them "
452 "hold nested sizers."
455 ("Flexible Grid", makeGrid3
,
456 "This grid allows the rows to have different heights and the columns to have "
457 "different widths. You can also specify rows and columns that are growable, "
458 "which we have done for the first and last row and the middle column for "
460 "\nThere is also a spacer in the middle cell instead of an actual window."
463 ("Grid with Alignment", makeGrid4
,
464 "New alignment flags allow for the positioning of items in any corner or centered "
470 ("Proportional resize", makeSimpleBoxShaped
,
471 "Managed items can preserve their original aspect ratio. The last item has the "
472 "wx.SHAPED flag set and will resize proportional to its original size."
475 ("Proportional resize with Alignments", makeShapes
,
476 "This one shows various alignments as well as proportional resizing for all items."
480 #----------------------------------------------------------------------
482 class TestFrame(wx
.Frame
):
483 def __init__(self
, parent
, title
, sizerFunc
):
484 wx
.Frame
.__init
__(self
, parent
, -1, title
)
485 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
)
487 p
= wx
.Panel(self
, -1)
489 self
.sizer
= sizerFunc(p
)
490 self
.CreateStatusBar()
491 self
.SetStatusText("Resize this frame to see how the sizers respond...")
494 p
.SetAutoLayout(True)
495 p
.SetSizer(self
.sizer
)
496 self
.Bind(wx
.EVT_CLOSE
, self
.OnCloseWindow
)
499 def OnCloseWindow(self
, event
):
500 self
.MakeModal(False)
503 def OnButton(self
, event
):
506 #----------------------------------------------------------------------
510 class TestSelectionPanel(wx
.Panel
):
511 def __init__(self
, parent
, frame
):
512 wx
.Panel
.__init
__(self
, parent
, -1)
515 self
.list = wx
.ListBox(self
, -1,
516 wx
.DLG_PNT(self
, 10, 10), wx
.DLG_SZE(self
, 100, 100),
518 self
.Bind(wx
.EVT_LISTBOX
, self
.OnSelect
, id=self
.list.GetId())
519 self
.Bind(wx
.EVT_LISTBOX_DCLICK
, self
.OnDClick
, id=self
.list.GetId())
521 self
.btn
= wx
.Button(self
, -1, "Try it!", wx
.DLG_PNT(self
, 120, 10)).SetDefault()
522 self
.Bind(wx
.EVT_BUTTON
, self
.OnDClick
)
524 self
.text
= wx
.TextCtrl(self
, -1, "",
525 wx
.DLG_PNT(self
, 10, 115),
526 wx
.DLG_SZE(self
, 200, 50),
527 wx
.TE_MULTILINE | wx
.TE_READONLY
)
529 for item
in theTests
:
530 self
.list.Append(item
[0])
533 def OnSelect(self
, event
):
534 pos
= self
.list.GetSelection()
535 self
.text
.SetValue(theTests
[pos
][2])
538 def OnDClick(self
, event
):
539 pos
= self
.list.GetSelection()
540 title
= theTests
[pos
][0]
541 func
= theTests
[pos
][1]
544 win
= TestFrame(self
, title
, func
)
545 win
.CentreOnParent(wx
.BOTH
)
549 #----------------------------------------------------------------------
551 def runTest(frame
, nb
, log
):
552 win
= TestSelectionPanel(nb
, frame
)
557 #----------------------------------------------------------------------
559 if __name__
== '__main__':
561 class MainFrame(wx
.Frame
):
563 wx
.Frame
.__init
__(self
, None, -1, "Testing...")
565 self
.CreateStatusBar()
566 mainmenu
= wx
.MenuBar()
568 menu
.Append(200, 'E&xit', 'Get the heck outta here!')
569 mainmenu
.Append(menu
, "&File")
570 self
.SetMenuBar(mainmenu
)
571 self
.Bind(wx
.EVT_MENU
, self
.OnExit
, id=200)
572 self
.panel
= TestSelectionPanel(self
, self
)
573 self
.SetSize((400, 380))
574 self
.Bind(wx
.EVT_CLOSE
, self
.OnCloseWindow
)
576 def OnCloseWindow(self
, event
):
579 def OnExit(self
, event
):
583 class TestApp(wx
.App
):
587 self
.SetTopWindow(frame
)
594 #----------------------------------------------------------------------