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