]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/Sizers.py
reSWIGged
[wxWidgets.git] / wxPython / demo / Sizers.py
... / ...
CommitLineData
1# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4# o Issues exist that will probably need to be addressed in the 2.5 build.
5#
6# 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
7#
8# o Had to do a bit of rework for the demo; there was no panel attached
9# to the demo window, so all buttons were showing as dark gray on
10# dark gray. I have no idea why this didn't break before. Robin,
11# please examine my changes to ensure you approve. It's rather
12# hackish looking.
13#
14
15#----------------------------------------------------------------------
16# sizer test code
17#----------------------------------------------------------------------
18
19import wx
20
21#----------------------------------------------------------------------
22
23def makeSimpleBox1(win):
24 box = wx.BoxSizer(wx.HORIZONTAL)
25 box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
26 box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
27 box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
28 box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
29
30 return box
31
32#----------------------------------------------------------------------
33
34def makeSimpleBox2(win):
35 box = wx.BoxSizer(wx.VERTICAL)
36 box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
37 box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
38 box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
39 box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
40
41 return box
42
43#----------------------------------------------------------------------
44
45def makeSimpleBox3(win):
46 box = wx.BoxSizer(wx.HORIZONTAL)
47 box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
48 box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
49 box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
50 box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
51 box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
52
53 return box
54
55#----------------------------------------------------------------------
56
57def makeSimpleBox4(win):
58 box = wx.BoxSizer(wx.HORIZONTAL)
59 box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
60 box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
61 box.Add(wx.Button(win, -1, "three"), 1, wx.EXPAND)
62 box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
63 box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
64
65 return box
66
67#----------------------------------------------------------------------
68
69def makeSimpleBox5(win):
70 box = wx.BoxSizer(wx.HORIZONTAL)
71 box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
72 box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
73 box.Add(wx.Button(win, -1, "three"), 3, wx.EXPAND)
74 box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
75 box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
76
77 return box
78
79#----------------------------------------------------------------------
80
81def makeSimpleBox6(win):
82 box = wx.BoxSizer(wx.HORIZONTAL)
83 box.Add(wx.Button(win, -1, "one"), 1, wx.ALIGN_TOP)
84 box.Add(wx.Button(win, -1, "two"), 1, wx.EXPAND)
85 box.Add(wx.Button(win, -1, "three"), 1, wx.ALIGN_CENTER)
86 box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
87 box.Add(wx.Button(win, -1, "five"), 1, wx.ALIGN_BOTTOM)
88
89 return box
90
91#----------------------------------------------------------------------
92
93def makeSimpleBox7(win):
94 box = wxBoxSizer(wxHORIZONTAL)
95 box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
96 box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
97 box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
98 box.Add((60, 20), 0, wxEXPAND)
99 box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
100
101 return box
102
103#----------------------------------------------------------------------
104
105def makeSimpleBox8(win):
106 box = wxBoxSizer(wxVERTICAL)
107 box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
108 box.Add((0,0), 1)
109 box.Add(wxButton(win, 1010, "two"), 0, wxALIGN_CENTER)
110 box.Add((0,0), 1)
111 box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
112 box.Add(wxButton(win, 1010, "four"), 0, wxEXPAND)
113# box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
114
115 return box
116
117#----------------------------------------------------------------------
118#----------------------------------------------------------------------
119
120def makeSimpleBorder1(win):
121 bdr = wx.BoxSizer(wx.HORIZONTAL)
122 btn = wx.Button(win, -1, "border")
123 btn.SetSize((80, 80))
124 bdr.Add(btn, 1, wx.EXPAND|wx.ALL, 15)
125
126 return bdr
127
128#----------------------------------------------------------------------
129
130def makeSimpleBorder2(win):
131 bdr = wx.BoxSizer(wx.HORIZONTAL)
132 btn = wx.Button(win, -1, "border")
133 btn.SetSize((80, 80))
134 bdr.Add(btn, 1, wx.EXPAND | wx.EAST | wx.WEST, 15)
135
136 return bdr
137
138#----------------------------------------------------------------------
139
140def makeSimpleBorder3(win):
141 bdr = wx.BoxSizer(wx.HORIZONTAL)
142 btn = wx.Button(win, -1, "border")
143 btn.SetSize((80, 80))
144 bdr.Add(btn, 1, wx.EXPAND | wx.NORTH | wx.WEST, 15)
145
146 return bdr
147
148#----------------------------------------------------------------------
149#----------------------------------------------------------------------
150
151def makeBoxInBox(win):
152 box = wx.BoxSizer(wx.VERTICAL)
153
154 box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
155
156 box2 = wx.BoxSizer(wx.HORIZONTAL)
157 box2.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
158 btn3 = wx.Button(win, -1, "three")
159 box2.Add(btn3, 0, wx.EXPAND)
160 box2.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
161 box2.Add(wx.Button(win, -1, "five"), 0, wx.EXPAND)
162
163 box3 = wx.BoxSizer(wx.VERTICAL)
164 box3.AddMany([ (wx.Button(win, -1, "six"), 0, wx.EXPAND),
165 (wx.Button(win, -1, "seven"), 2, wx.EXPAND),
166 (wx.Button(win, -1, "eight"), 1, wx.EXPAND),
167 (wx.Button(win, -1, "nine"), 1, wx.EXPAND),
168 ])
169
170 box2.Add(box3, 1, wx.EXPAND)
171 box.Add(box2, 1, wx.EXPAND)
172
173 box.Add(wx.Button(win, -1, "ten"), 0, wx.EXPAND)
174
175 ##box.Hide(btn3)
176
177 return box
178
179#----------------------------------------------------------------------
180
181def makeBoxInBorder(win):
182 bdr = wx.BoxSizer(wx.HORIZONTAL)
183 box = makeSimpleBox3(win)
184 bdr.Add(box, 1, wx.EXPAND | wx.ALL, 15)
185
186 return bdr
187
188#----------------------------------------------------------------------
189
190def makeBorderInBox(win):
191 insideBox = wx.BoxSizer(wx.HORIZONTAL)
192
193 box2 = wx.BoxSizer(wx.HORIZONTAL)
194 box2.AddMany([ (wx.Button(win, -1, "one"), 0, wx.EXPAND),
195 (wx.Button(win, -1, "two"), 0, wx.EXPAND),
196 (wx.Button(win, -1, "three"), 0, wx.EXPAND),
197 (wx.Button(win, -1, "four"), 0, wx.EXPAND),
198 (wx.Button(win, -1, "five"), 0, wx.EXPAND),
199 ])
200
201 insideBox.Add(box2, 0, wx.EXPAND)
202
203 bdr = wx.BoxSizer(wx.HORIZONTAL)
204 bdr.Add(wx.Button(win, -1, "border"), 1, wx.EXPAND | wx.ALL)
205 insideBox.Add(bdr, 1, wx.EXPAND | wx.ALL, 20)
206
207 box3 = wx.BoxSizer(wx.VERTICAL)
208 box3.AddMany([ (wx.Button(win, -1, "six"), 0, wx.EXPAND),
209 (wx.Button(win, -1, "seven"), 2, wx.EXPAND),
210 (wx.Button(win, -1, "eight"), 1, wx.EXPAND),
211 (wx.Button(win, -1, "nine"), 1, wx.EXPAND),
212 ])
213 insideBox.Add(box3, 1, wx.EXPAND)
214
215 outsideBox = wx.BoxSizer(wx.VERTICAL)
216 outsideBox.Add(wx.Button(win, -1, "top"), 0, wx.EXPAND)
217 outsideBox.Add(insideBox, 1, wx.EXPAND)
218 outsideBox.Add(wx.Button(win, -1, "bottom"), 0, wx.EXPAND)
219
220 return outsideBox
221
222
223#----------------------------------------------------------------------
224
225def makeGrid1(win):
226 gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
227
228 gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.EXPAND),
229 (wx.Button(win, -1, 'two'), 0, wx.EXPAND),
230 (wx.Button(win, -1, 'three'), 0, wx.EXPAND),
231 (wx.Button(win, -1, 'four'), 0, wx.EXPAND),
232 (wx.Button(win, -1, 'five'), 0, wx.EXPAND),
233 #(75, 50),
234 (wx.Button(win, -1, 'six'), 0, wx.EXPAND),
235 (wx.Button(win, -1, 'seven'), 0, wx.EXPAND),
236 (wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
237 (wx.Button(win, -1, 'nine'), 0, wx.EXPAND),
238 ])
239
240 return gs
241
242#----------------------------------------------------------------------
243
244def makeGrid2(win):
245 gs = wx.GridSizer(3, 3) # rows, cols, hgap, vgap
246
247 box = wx.BoxSizer(wx.VERTICAL)
248 box.Add(wx.Button(win, -1, 'A'), 0, wx.EXPAND)
249 box.Add(wx.Button(win, -1, 'B'), 1, wx.EXPAND)
250
251 gs2 = wx.GridSizer(2,2, 4, 4)
252 gs2.AddMany([ (wx.Button(win, -1, 'C'), 0, wx.EXPAND),
253 (wx.Button(win, -1, 'E'), 0, wx.EXPAND),
254 (wx.Button(win, -1, 'F'), 0, wx.EXPAND),
255 (wx.Button(win, -1, 'G'), 0, wx.EXPAND)])
256
257 gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM),
258 (wx.Button(win, -1, 'two'), 0, wx.EXPAND),
259 (wx.Button(win, -1, 'three'), 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM),
260 (wx.Button(win, -1, 'four'), 0, wx.EXPAND),
261 (wx.Button(win, -1, 'five'), 0, wx.ALIGN_CENTER),
262 (wx.Button(win, -1, 'six'), 0, wx.EXPAND),
263 (box, 0, wx.EXPAND | wx.ALL, 10),
264 (wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
265 (gs2, 0, wx.EXPAND | wx.ALL, 4),
266 ])
267
268 return gs
269
270#----------------------------------------------------------------------
271
272def makeGrid3(win):
273 gs = wx.FlexGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
274
275 gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.EXPAND),
276 (wx.Button(win, -1, 'two'), 0, wx.EXPAND),
277 (wx.Button(win, -1, 'three'), 0, wx.EXPAND),
278 (wx.Button(win, -1, 'four'), 0, wx.EXPAND),
279 #(wxButton(win, 1010, 'five'), 0, wxEXPAND),
280 ((175, 50)),
281 (wx.Button(win, -1, 'six'), 0, wx.EXPAND),
282 (wx.Button(win, -1, 'seven'), 0, wx.EXPAND),
283 (wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
284 (wx.Button(win, -1, 'nine'), 0, wx.EXPAND),
285 ])
286
287 gs.AddGrowableRow(0)
288 gs.AddGrowableRow(2)
289 gs.AddGrowableCol(1)
290 return gs
291
292#----------------------------------------------------------------------
293
294def makeGrid4(win):
295 bpos = wx.DefaultPosition
296 bsize = wx.Size(100, 50)
297 gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
298
299 gs.AddMany([ (wx.Button(win, -1, 'one', bpos, bsize),
300 0, wx.ALIGN_TOP | wx.ALIGN_LEFT ),
301 (wx.Button(win, -1, 'two', bpos, bsize),
302 0, wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL ),
303 (wx.Button(win, -1, 'three', bpos, bsize),
304 0, wx.ALIGN_TOP | wx.ALIGN_RIGHT ),
305 (wx.Button(win, -1, 'four', bpos, bsize),
306 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT ),
307 (wx.Button(win, -1, 'five', bpos, bsize),
308 0, wx.ALIGN_CENTER ),
309 (wx.Button(win, -1, 'six', bpos, bsize),
310 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT ),
311 (wx.Button(win, -1, 'seven', bpos, bsize),
312 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT ),
313 (wx.Button(win, -1, 'eight', bpos, bsize),
314 0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL ),
315 (wx.Button(win, -1, 'nine', bpos, bsize),
316 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT ),
317 ])
318
319 return gs
320
321#----------------------------------------------------------------------
322
323def makeShapes(win):
324 bpos = wx.DefaultPosition
325 bsize = wx.Size(100, 50)
326 gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
327
328 gs.AddMany([ (wx.Button(win, -1, 'one', bpos, bsize),
329 0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_LEFT ),
330 (wx.Button(win, -1, 'two', bpos, bsize),
331 0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL ),
332 (wx.Button(win, -1, 'three', bpos, bsize),
333 0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_RIGHT ),
334 (wx.Button(win, -1, 'four', bpos, bsize),
335 0, wx.SHAPED | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT ),
336 (wx.Button(win, -1, 'five', bpos, bsize),
337 0, wx.SHAPED | wx.ALIGN_CENTER ),
338 (wx.Button(win, -1, 'six', bpos, bsize),
339 0, wx.SHAPED | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT ),
340 (wx.Button(win, -1, 'seven', bpos, bsize),
341 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT ),
342 (wx.Button(win, -1, 'eight', bpos, bsize),
343 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL ),
344 (wx.Button(win, -1, 'nine', bpos, bsize),
345 0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT ),
346 ])
347
348 return gs
349
350#----------------------------------------------------------------------
351
352def makeSimpleBoxShaped(win):
353 box = wx.BoxSizer(wx.HORIZONTAL)
354 box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
355 box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
356 box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
357 box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
358 box.Add(wx.Button(win, -1, "five"), 1, wx.SHAPED)
359
360 return box
361
362#----------------------------------------------------------------------
363
364theTests = [
365 ("Simple horizontal boxes", makeSimpleBox1,
366 "This is a HORIZONTAL box sizer with four non-stretchable buttons held "
367 "within it. Notice that the buttons are added and aligned in the horizontal "
368 "dimension. Also notice that they are fixed size in the horizontal dimension, "
369 "but will stretch vertically."
370 ),
371
372 ("Simple vertical boxes", makeSimpleBox2,
373 "Exactly the same as the previous sample but using a VERTICAL box sizer "
374 "instead of a HORIZONTAL one."
375 ),
376
377 ("Add a stretchable", makeSimpleBox3,
378 "We've added one more button with the stretchable flag turned on. Notice "
379 "how it grows to fill the extra space in the otherwise fixed dimension."
380 ),
381
382 ("More than one stretchable", makeSimpleBox4,
383 "Here there are several items that are stretchable, they all divide up the "
384 "extra space evenly."
385 ),
386
387 ("Weighting factor", makeSimpleBox5,
388 "This one shows more than one stretchable, but one of them has a weighting "
389 "factor so it gets more of the free space."
390 ),
391
392 ("Edge Affinity", makeSimpleBox6,
393 "For items that don't completly fill their allotted space, and don't "
394 "stretch, you can specify which side (or the center) they should stay "
395 "attached to."
396 ),
397
398 ("Spacer", makeSimpleBox7,
399 "You can add empty space to be managed by a Sizer just as if it were a "
400 "window or another Sizer."
401 ),
402
403 ("Centering in available space", makeSimpleBox8,
404 "This one shows an item that does not expand to fill it's space, but rather"
405 "stays centered within it."
406 ),
407
408# ("Percent Sizer", makeSimpleBox6,
409# "You can use the wx.BoxSizer like a Percent Sizer. Just make sure that all "
410# "the weighting factors add up to 100!"
411# ),
412
413 ("", None, ""),
414
415 ("Simple border sizer", makeSimpleBorder1,
416 "The wx.BoxSizer can leave empty space around its contents. This one "
417 "gives a border all the way around."
418 ),
419
420 ("East and West border", makeSimpleBorder2,
421 "You can pick and choose which sides have borders."
422 ),
423
424 ("North and West border", makeSimpleBorder3,
425 "You can pick and choose which sides have borders."
426 ),
427
428 ("", None, ""),
429
430 ("Boxes inside of boxes", makeBoxInBox,
431 "This one shows nesting of boxes within boxes within boxes, using both "
432 "orientations. Notice also that button seven has a greater weighting "
433 "factor than its siblings."
434 ),
435
436 ("Boxes inside a Border", makeBoxInBorder,
437 "Sizers of different types can be nested within each other as well. "
438 "Here is a box sizer with several buttons embedded within a border sizer."
439 ),
440
441 ("Border in a Box", makeBorderInBox,
442 "Another nesting example. This one has Boxes and a Border inside another Box."
443 ),
444
445 ("", None, ""),
446
447 ("Simple Grid", makeGrid1,
448 "This is an example of the wxGridSizer. In this case all row heights "
449 "and column widths are kept the same as all the others and all items "
450 "fill their available space. The horizontal and vertical gaps are set to "
451 "2 pixels each."
452 ),
453
454 ("More Grid Features", makeGrid2,
455 "This is another example of the wxGridSizer. This one has no gaps in the grid, "
456 "but various cells are given different alignment options and some of them "
457 "hold nested sizers."
458 ),
459
460 ("Flexible Grid", makeGrid3,
461 "This grid allows the rows to have different heights and the columns to have "
462 "different widths. You can also specify rows and columns that are growable, "
463 "which we have done for the first and last row and the middle column for "
464 "this example.\n"
465 "\nThere is also a spacer in the middle cell instead of an actual window."
466 ),
467
468 ("Grid with Alignment", makeGrid4,
469 "New alignment flags allow for the positioning of items in any corner or centered "
470 "position."
471 ),
472
473 ("", None, ""),
474
475 ("Proportional resize", makeSimpleBoxShaped,
476 "Managed items can preserve their original aspect ratio. The last item has the "
477 "wxSHAPED flag set and will resize proportional to its original size."
478 ),
479
480 ("Proportional resize with Alignments", makeShapes,
481 "This one shows various alignments as well as proportional resizing for all items."
482 ),
483
484 ]
485#----------------------------------------------------------------------
486
487class TestFrame(wx.Frame):
488 def __init__(self, parent, title, sizerFunc):
489 wx.Frame.__init__(self, parent, -1, title)
490 self.Bind(wx.EVT_BUTTON, self.OnButton)
491
492 p = wx.Panel(self, -1)
493
494 self.sizer = sizerFunc(p)
495 self.CreateStatusBar()
496 self.SetStatusText("Resize this frame to see how the sizers respond...")
497 self.sizer.Fit(p)
498
499 p.SetAutoLayout(True)
500 p.SetSizer(self.sizer)
501 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
502 self.Fit()
503
504 def OnCloseWindow(self, event):
505 self.MakeModal(False)
506 self.Destroy()
507
508 def OnButton(self, event):
509 self.Close(True)
510
511#----------------------------------------------------------------------
512
513
514
515class TestSelectionPanel(wx.Panel):
516 def __init__(self, parent, frame):
517 wx.Panel.__init__(self, parent, -1)
518 self.frame = frame
519
520 self.list = wx.ListBox(self, -1,
521 wx.DLG_PNT(self, 10, 10), wx.DLG_SZE(self, 100, 100),
522 [])
523 self.Bind(wx.EVT_LISTBOX, self.OnSelect, id=self.list.GetId())
524 self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnDClick, id=self.list.GetId())
525
526 self.btn = wx.Button(self, -1, "Try it!", wx.DLG_PNT(self, 120, 10)).SetDefault()
527 self.Bind(wx.EVT_BUTTON, self.OnDClick)
528
529 self.text = wx.TextCtrl(self, -1, "",
530 wx.DLG_PNT(self, 10, 115),
531 wx.DLG_SZE(self, 200, 50),
532 wx.TE_MULTILINE | wx.TE_READONLY)
533
534 for item in theTests:
535 self.list.Append(item[0])
536
537
538 def OnSelect(self, event):
539 pos = self.list.GetSelection()
540 self.text.SetValue(theTests[pos][2])
541
542
543 def OnDClick(self, event):
544 pos = self.list.GetSelection()
545 title = theTests[pos][0]
546 func = theTests[pos][1]
547
548 if func:
549 win = TestFrame(self, title, func)
550 win.CentreOnParent(wx.BOTH)
551 win.Show(True)
552 win.MakeModal(True)
553
554#----------------------------------------------------------------------
555
556def runTest(frame, nb, log):
557 win = TestSelectionPanel(nb, frame)
558 return win
559
560overview = ""
561#wxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \
562#wxBoxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \
563#wxBorderSizer.__doc__
564
565#----------------------------------------------------------------------
566
567if __name__ == '__main__':
568
569 class MainFrame(wx.Frame):
570 def __init__(self):
571 wx.Frame.__init__(self, None, -1, "Testing...")
572
573 self.CreateStatusBar()
574 mainmenu = wx.MenuBar()
575 menu = wx.Menu()
576 menu.Append(200, 'E&xit', 'Get the heck outta here!')
577 mainmenu.Append(menu, "&File")
578 self.SetMenuBar(mainmenu)
579 self.Bind(wx.EVT_MENU, self.OnExit, id=200)
580 self.panel = TestSelectionPanel(self, self)
581 self.SetSize((400, 380))
582 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
583
584 def OnCloseWindow(self, event):
585 self.Destroy()
586
587 def OnExit(self, event):
588 self.Close(True)
589
590
591 class TestApp(wx.App):
592 def OnInit(self):
593 frame = MainFrame()
594 frame.Show(True)
595 self.SetTopWindow(frame)
596 return True
597
598 app = TestApp(False)
599 app.MainLoop()
600
601
602#----------------------------------------------------------------------