]>
Commit | Line | Data |
---|---|---|
bb0054cd RD |
1 | #---------------------------------------------------------------------- |
2 | # sizer test code | |
3 | #---------------------------------------------------------------------- | |
4 | ||
2f90df85 RD |
5 | from wxPython.wx import * |
6 | from wxPython.lib.grids import wxGridSizer, wxFlexGridSizer | |
bb0054cd RD |
7 | |
8 | #---------------------------------------------------------------------- | |
9 | ||
10 | def makeSimpleBox1(win): | |
11 | box = wxBoxSizer(wxHORIZONTAL) | |
f0261a72 RD |
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) | |
bb0054cd RD |
16 | |
17 | return box | |
18 | ||
19 | #---------------------------------------------------------------------- | |
20 | ||
21 | def makeSimpleBox2(win): | |
22 | box = wxBoxSizer(wxVERTICAL) | |
f0261a72 RD |
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) | |
bb0054cd RD |
27 | |
28 | return box | |
29 | ||
30 | #---------------------------------------------------------------------- | |
31 | ||
32 | def makeSimpleBox3(win): | |
33 | box = wxBoxSizer(wxHORIZONTAL) | |
f0261a72 RD |
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) | |
bb0054cd RD |
39 | |
40 | return box | |
41 | ||
42 | #---------------------------------------------------------------------- | |
43 | ||
44 | def makeSimpleBox4(win): | |
45 | box = wxBoxSizer(wxHORIZONTAL) | |
f0261a72 RD |
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) | |
bb0054cd RD |
51 | |
52 | return box | |
53 | ||
54 | #---------------------------------------------------------------------- | |
55 | ||
56 | def makeSimpleBox5(win): | |
57 | box = wxBoxSizer(wxHORIZONTAL) | |
f0261a72 RD |
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) | |
bb0054cd RD |
63 | |
64 | return box | |
65 | ||
66 | #---------------------------------------------------------------------- | |
67 | ||
68 | def makeSimpleBox6(win): | |
2f90df85 RD |
69 | box = wxBoxSizer(wxHORIZONTAL) |
70 | box.Add(wxButton(win, 1010, "one"), 1, wxALIGN_TOP) | |
f0261a72 | 71 | box.Add(wxButton(win, 1010, "two"), 1, wxEXPAND) |
2f90df85 | 72 | box.Add(wxButton(win, 1010, "three"), 1, wxCENTER) |
f0261a72 | 73 | box.Add(wxButton(win, 1010, "four"), 1, wxEXPAND) |
2f90df85 RD |
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) | |
f0261a72 RD |
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) | |
bb0054cd RD |
87 | |
88 | return box | |
89 | ||
90 | #---------------------------------------------------------------------- | |
2f90df85 | 91 | #---------------------------------------------------------------------- |
bb0054cd RD |
92 | |
93 | def makeSimpleBorder1(win): | |
2f90df85 | 94 | bdr = wxBoxSizer(wxHORIZONTAL) |
bb0054cd RD |
95 | btn = wxButton(win, 1010, "border") |
96 | btn.SetSize(wxSize(80, 80)) | |
f0261a72 | 97 | bdr.Add(btn, 1, wxEXPAND|wxALL, 15) |
bb0054cd RD |
98 | |
99 | return bdr | |
100 | ||
101 | #---------------------------------------------------------------------- | |
102 | ||
103 | def makeSimpleBorder2(win): | |
2f90df85 | 104 | bdr = wxBoxSizer(wxHORIZONTAL) |
bb0054cd RD |
105 | btn = wxButton(win, 1010, "border") |
106 | btn.SetSize(wxSize(80, 80)) | |
f0261a72 | 107 | bdr.Add(btn, 1, wxEXPAND | wxEAST | wxWEST, 15) |
bb0054cd RD |
108 | |
109 | return bdr | |
110 | ||
111 | #---------------------------------------------------------------------- | |
112 | ||
113 | def makeSimpleBorder3(win): | |
2f90df85 | 114 | bdr = wxBoxSizer(wxHORIZONTAL) |
bb0054cd RD |
115 | btn = wxButton(win, 1010, "border") |
116 | btn.SetSize(wxSize(80, 80)) | |
f0261a72 | 117 | bdr.Add(btn, 1, wxEXPAND | wxNORTH | wxWEST, 15) |
bb0054cd RD |
118 | |
119 | return bdr | |
120 | ||
121 | #---------------------------------------------------------------------- | |
122 | #---------------------------------------------------------------------- | |
123 | ||
124 | def makeBoxInBox(win): | |
125 | box = wxBoxSizer(wxVERTICAL) | |
126 | ||
f0261a72 | 127 | box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND) |
bb0054cd RD |
128 | |
129 | box2 = wxBoxSizer(wxHORIZONTAL) | |
f0261a72 RD |
130 | box2.AddMany([ (wxButton(win, 1010, "two"), 0, wxEXPAND), |
131 | (wxButton(win, 1010, "three"), 0, wxEXPAND), | |
132 | (wxButton(win, 1010, "four"), 0, wxEXPAND), | |
133 | (wxButton(win, 1010, "five"), 0, wxEXPAND), | |
8bf5d46e | 134 | ]) |
bb0054cd RD |
135 | |
136 | box3 = wxBoxSizer(wxVERTICAL) | |
f0261a72 RD |
137 | box3.AddMany([ (wxButton(win, 1010, "six"), 0, wxEXPAND), |
138 | (wxButton(win, 1010, "seven"), 2, wxEXPAND), | |
139 | (wxButton(win, 1010, "eight"), 1, wxEXPAND), | |
140 | (wxButton(win, 1010, "nine"), 1, wxEXPAND), | |
bb0054cd RD |
141 | ]) |
142 | ||
f0261a72 RD |
143 | box2.Add(box3, 1, wxEXPAND) |
144 | box.Add(box2, 1, wxEXPAND) | |
bb0054cd | 145 | |
f0261a72 | 146 | box.Add(wxButton(win, 1010, "ten"), 0, wxEXPAND) |
bb0054cd RD |
147 | |
148 | return box | |
149 | ||
150 | #---------------------------------------------------------------------- | |
151 | ||
152 | def makeBoxInBorder(win): | |
2f90df85 | 153 | bdr = wxBoxSizer(wxHORIZONTAL) |
bb0054cd | 154 | box = makeSimpleBox3(win) |
f0261a72 | 155 | bdr.Add(box, 1, wxEXPAND | wxALL, 15) |
bb0054cd RD |
156 | |
157 | return bdr | |
158 | ||
159 | #---------------------------------------------------------------------- | |
160 | ||
161 | def makeBorderInBox(win): | |
162 | insideBox = wxBoxSizer(wxHORIZONTAL) | |
5662a243 RD |
163 | |
164 | box2 = wxBoxSizer(wxHORIZONTAL) | |
f0261a72 RD |
165 | box2.AddMany([ (wxButton(win, 1010, "one"), 0, wxEXPAND), |
166 | (wxButton(win, 1010, "two"), 0, wxEXPAND), | |
167 | (wxButton(win, 1010, "three"), 0, wxEXPAND), | |
168 | (wxButton(win, 1010, "four"), 0, wxEXPAND), | |
169 | (wxButton(win, 1010, "five"), 0, wxEXPAND), | |
5662a243 RD |
170 | ]) |
171 | ||
f0261a72 | 172 | insideBox.Add(box2, 0, wxEXPAND) |
bb0054cd | 173 | |
2f90df85 | 174 | bdr = wxBoxSizer(wxHORIZONTAL) |
f0261a72 RD |
175 | bdr.Add(wxButton(win, 1010, "border"), 1, wxEXPAND | wxALL) |
176 | insideBox.Add(bdr, 1, wxEXPAND | wxALL, 20) | |
bb0054cd RD |
177 | |
178 | box3 = wxBoxSizer(wxVERTICAL) | |
f0261a72 RD |
179 | box3.AddMany([ (wxButton(win, 1010, "six"), 0, wxEXPAND), |
180 | (wxButton(win, 1010, "seven"), 2, wxEXPAND), | |
181 | (wxButton(win, 1010, "eight"), 1, wxEXPAND), | |
182 | (wxButton(win, 1010, "nine"), 1, wxEXPAND), | |
5662a243 | 183 | ]) |
f0261a72 | 184 | insideBox.Add(box3, 1, wxEXPAND) |
bb0054cd RD |
185 | |
186 | outsideBox = wxBoxSizer(wxVERTICAL) | |
f0261a72 RD |
187 | outsideBox.Add(wxButton(win, 1010, "top"), 0, wxEXPAND) |
188 | outsideBox.Add(insideBox, 1, wxEXPAND) | |
189 | outsideBox.Add(wxButton(win, 1010, "bottom"), 0, wxEXPAND) | |
bb0054cd RD |
190 | |
191 | return outsideBox | |
192 | ||
193 | ||
194 | #---------------------------------------------------------------------- | |
195 | ||
2f90df85 RD |
196 | def makeGrid1(win): |
197 | gs = wxGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap | |
198 | ||
f0261a72 RD |
199 | gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxEXPAND), |
200 | (wxButton(win, 1010, 'two'), 0, wxEXPAND), | |
201 | (wxButton(win, 1010, 'three'), 0, wxEXPAND), | |
202 | (wxButton(win, 1010, 'four'), 0, wxEXPAND), | |
203 | (wxButton(win, 1010, 'five'), 0, wxEXPAND), | |
2f90df85 | 204 | #(75, 50), |
f0261a72 RD |
205 | (wxButton(win, 1010, 'six'), 0, wxEXPAND), |
206 | (wxButton(win, 1010, 'seven'), 0, wxEXPAND), | |
207 | (wxButton(win, 1010, 'eight'), 0, wxEXPAND), | |
208 | (wxButton(win, 1010, 'nine'), 0, wxEXPAND), | |
2f90df85 RD |
209 | ]) |
210 | ||
211 | return gs | |
212 | ||
213 | #---------------------------------------------------------------------- | |
214 | ||
215 | def makeGrid2(win): | |
216 | gs = wxGridSizer(3, 3) # rows, cols, hgap, vgap | |
217 | ||
218 | box = wxBoxSizer(wxVERTICAL) | |
f0261a72 RD |
219 | box.Add(wxButton(win, 1010, 'A'), 0, wxEXPAND) |
220 | box.Add(wxButton(win, 1010, 'B'), 1, wxEXPAND) | |
2f90df85 RD |
221 | |
222 | gs2 = wxGridSizer(2,2, 4, 4) | |
f0261a72 RD |
223 | gs2.AddMany([ (wxButton(win, 1010, 'C'), 0, wxEXPAND), |
224 | (wxButton(win, 1010, 'E'), 0, wxEXPAND), | |
225 | (wxButton(win, 1010, 'F'), 0, wxEXPAND), | |
226 | (wxButton(win, 1010, 'G'), 0, wxEXPAND)]) | |
2f90df85 RD |
227 | |
228 | gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxALIGN_RIGHT | wxALIGN_BOTTOM), | |
f0261a72 | 229 | (wxButton(win, 1010, 'two'), 0, wxEXPAND), |
2f90df85 | 230 | (wxButton(win, 1010, 'three'), 0, wxALIGN_LEFT | wxALIGN_BOTTOM), |
f0261a72 | 231 | (wxButton(win, 1010, 'four'), 0, wxEXPAND), |
2f90df85 | 232 | (wxButton(win, 1010, 'five'), 0, wxCENTER), |
f0261a72 RD |
233 | (wxButton(win, 1010, 'six'), 0, wxEXPAND), |
234 | (box, 0, wxEXPAND | wxALL, 10), | |
235 | (wxButton(win, 1010, 'eight'), 0, wxEXPAND), | |
236 | (gs2, 0, wxEXPAND | wxALL, 4), | |
2f90df85 RD |
237 | ]) |
238 | ||
239 | return gs | |
240 | ||
241 | #---------------------------------------------------------------------- | |
242 | ||
243 | def makeGrid3(win): | |
244 | gs = wxFlexGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap | |
245 | ||
f0261a72 RD |
246 | gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxEXPAND), |
247 | (wxButton(win, 1010, 'two'), 0, wxEXPAND), | |
248 | (wxButton(win, 1010, 'three'), 0, wxEXPAND), | |
249 | (wxButton(win, 1010, 'four'), 0, wxEXPAND), | |
250 | #(wxButton(win, 1010, 'five'), 0, wxEXPAND), | |
2f90df85 | 251 | (175, 50), |
f0261a72 RD |
252 | (wxButton(win, 1010, 'six'), 0, wxEXPAND), |
253 | (wxButton(win, 1010, 'seven'), 0, wxEXPAND), | |
254 | (wxButton(win, 1010, 'eight'), 0, wxEXPAND), | |
255 | (wxButton(win, 1010, 'nine'), 0, wxEXPAND), | |
2f90df85 RD |
256 | ]) |
257 | ||
258 | gs.AddGrowableRow(0) | |
259 | gs.AddGrowableRow(2) | |
260 | gs.AddGrowableCol(1) | |
261 | return gs | |
262 | ||
263 | #---------------------------------------------------------------------- | |
264 | ||
bb0054cd RD |
265 | theTests = [ |
266 | ("Simple horizontal boxes", makeSimpleBox1, | |
267 | "This is a HORIZONTAL box sizer with four non-stretchable buttons held " | |
268 | "within it. Notice that the buttons are added and aligned in the horizontal " | |
269 | "dimension. Also notice that they are fixed size in the horizontal dimension, " | |
270 | "but will stretch vertically." | |
271 | ), | |
272 | ||
273 | ("Simple vertical boxes", makeSimpleBox2, | |
274 | "Exactly the same as the previous sample but using a VERTICAL box sizer " | |
275 | "instead of a HORIZONTAL one." | |
276 | ), | |
277 | ||
278 | ("Add a stretchable", makeSimpleBox3, | |
279 | "We've added one more button with the strechable flag turned on. Notice " | |
280 | "how it grows to fill the extra space in the otherwise fixed dimension." | |
281 | ), | |
282 | ||
283 | ("More than one stretchable", makeSimpleBox4, | |
284 | "Here there are several items that are stretchable, they all divide up the " | |
285 | "extra space evenly." | |
286 | ), | |
287 | ||
288 | ("Weighting factor", makeSimpleBox5, | |
289 | "This one shows more than one strechable, but one of them has a weighting " | |
290 | "factor so it gets more of the free space." | |
291 | ), | |
292 | ||
2f90df85 RD |
293 | ("Edge Affinity", makeSimpleBox6, |
294 | "For items that don't completly fill their allotted space, and don't " | |
295 | "stretch, you can specify which side (or the center) they should stay " | |
296 | "attached to." | |
297 | ), | |
298 | ||
299 | ("Spacer", makeSimpleBox7, | |
300 | "You can add empty space to be managed by a Sizer just as if it were a " | |
301 | "window or another Sizer." | |
302 | ), | |
303 | ||
bb0054cd RD |
304 | # ("Percent Sizer", makeSimpleBox6, |
305 | # "You can use the wxBoxSizer like a Percent Sizer. Just make sure that all " | |
306 | # "the weighting factors add up to 100!" | |
307 | # ), | |
308 | ||
309 | ("", None, ""), | |
310 | ||
311 | ("Simple border sizer", makeSimpleBorder1, | |
312 | "The wxBorderSizer leaves empty space around its contents. This one " | |
313 | "gives a border all the way around." | |
314 | ), | |
315 | ||
316 | ("East and West border", makeSimpleBorder2, | |
317 | "You can pick and choose which sides have borders." | |
318 | ), | |
319 | ||
320 | ("North and West border", makeSimpleBorder3, | |
321 | "You can pick and choose which sides have borders." | |
322 | ), | |
323 | ||
324 | ("", None, ""), | |
325 | ||
326 | ("Boxes inside of boxes", makeBoxInBox, | |
327 | "This one shows nesting of boxes within boxes within boxes, using both " | |
328 | "orientations. Notice also that button seven has a greater weighting " | |
329 | "factor than its siblings." | |
330 | ), | |
331 | ||
332 | ("Boxes inside a Border", makeBoxInBorder, | |
333 | "Sizers of different types can be nested withing each other as well. " | |
334 | "Here is a box sizer with several buttons embedded within a border sizer." | |
335 | ), | |
336 | ||
337 | ("Border in a Box", makeBorderInBox, | |
5662a243 | 338 | "Another nesting example. This one has Boxes and a Border inside another Box." |
bb0054cd RD |
339 | ), |
340 | ||
2f90df85 RD |
341 | ("", None, ""), |
342 | ||
343 | ("Simple Grid", makeGrid1, | |
344 | "This is an example of the wxGridSizer. In this case all row heights " | |
345 | "and column widths are kept the same as all the others and all items " | |
346 | "fill their available space. The horzontal and vertical gaps are set to " | |
347 | "2 pixels each." | |
348 | ), | |
349 | ||
350 | ("More Grid Features", makeGrid2, | |
351 | "This is another example of the wxGridSizer. This one has no gaps in the grid, " | |
352 | "but various cells are given different alignment options and some of them " | |
353 | "hold nested sizers." | |
354 | ), | |
355 | ||
356 | ("Flexible Grid", makeGrid3, | |
357 | "This grid allows the rows to have different heights and the columns to have " | |
358 | "different widths. You can also specify rows and columns that are growable, " | |
359 | "which we have done for the first and last row and the middle column for " | |
360 | "this example.\n" | |
361 | "\nThere is also a spacer in the middle cell instead of an actual window." | |
362 | ), | |
363 | ||
bb0054cd RD |
364 | ] |
365 | #---------------------------------------------------------------------- | |
366 | ||
367 | class TestFrame(wxFrame): | |
368 | def __init__(self, parent, title, sizerFunc): | |
369 | wxFrame.__init__(self, parent, -1, title) | |
370 | EVT_BUTTON(self, 1010, self.OnButton) | |
371 | ||
372 | self.sizer = sizerFunc(self) | |
373 | self.CreateStatusBar() | |
a08cbc01 | 374 | self.SetStatusText("Resize this frame to see how the sizers respond...") |
2f90df85 | 375 | self.sizer.Fit(self) |
bb0054cd | 376 | |
2f90df85 RD |
377 | self.SetAutoLayout(true) |
378 | self.SetSizer(self.sizer) | |
bb0054cd RD |
379 | |
380 | def OnCloseWindow(self, event): | |
381 | self.MakeModal(false) | |
382 | self.Destroy() | |
383 | ||
384 | def OnButton(self, event): | |
385 | self.Close(true) | |
386 | ||
387 | #---------------------------------------------------------------------- | |
388 | ||
389 | ||
390 | ||
391 | class TestSelectionPanel(wxPanel): | |
392 | def __init__(self, parent, frame): | |
393 | wxPanel.__init__(self, parent, -1) | |
394 | self.frame = frame | |
395 | ||
396 | self.list = wxListBox(self, 401, | |
2f90df85 | 397 | wxDLG_PNT(self, 10, 10), wxDLG_SZE(self, 100, 100), |
bb0054cd RD |
398 | []) |
399 | EVT_LISTBOX(self, 401, self.OnSelect) | |
400 | EVT_LISTBOX_DCLICK(self, 401, self.OnDClick) | |
401 | ||
2f90df85 | 402 | self.btn = wxButton(self, 402, "Try it!", wxDLG_PNT(self, 120, 10)).SetDefault() |
bb0054cd RD |
403 | EVT_BUTTON(self, 402, self.OnDClick) |
404 | ||
405 | self.text = wxTextCtrl(self, -1, "", | |
2f90df85 RD |
406 | wxDLG_PNT(self, 10, 115), |
407 | wxDLG_SZE(self, 200, 50), | |
bb0054cd RD |
408 | wxTE_MULTILINE | wxTE_READONLY) |
409 | ||
410 | for item in theTests: | |
411 | self.list.Append(item[0]) | |
412 | ||
413 | ||
414 | ||
415 | def OnSelect(self, event): | |
416 | pos = self.list.GetSelection() | |
417 | self.text.SetValue(theTests[pos][2]) | |
418 | ||
419 | ||
420 | def OnDClick(self, event): | |
421 | pos = self.list.GetSelection() | |
422 | title = theTests[pos][0] | |
423 | func = theTests[pos][1] | |
424 | ||
425 | if func: | |
426 | win = TestFrame(self, title, func) | |
427 | win.CentreOnParent(wxBOTH) | |
428 | win.Show(true) | |
429 | win.MakeModal(true) | |
430 | ||
431 | #---------------------------------------------------------------------- | |
432 | ||
433 | def runTest(frame, nb, log): | |
434 | win = TestSelectionPanel(nb, frame) | |
435 | return win | |
436 | ||
2f90df85 RD |
437 | overview = "" |
438 | #wxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \ | |
439 | #wxBoxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \ | |
440 | #wxBorderSizer.__doc__ | |
bb0054cd RD |
441 | |
442 | #---------------------------------------------------------------------- | |
443 | ||
444 | ||
445 | ||
446 | if __name__ == '__main__': | |
447 | ||
448 | class MainFrame(wxFrame): | |
449 | def __init__(self): | |
450 | wxFrame.__init__(self, NULL, -1, "Testing...") | |
451 | ||
452 | self.CreateStatusBar() | |
453 | mainmenu = wxMenuBar() | |
454 | menu = wxMenu() | |
455 | menu.Append(200, 'E&xit', 'Get the heck outta here!') | |
456 | mainmenu.Append(menu, "&File") | |
457 | self.SetMenuBar(mainmenu) | |
458 | EVT_MENU(self, 200, self.OnExit) | |
2f90df85 | 459 | self.panel = TestSelectionPanel(self, self) |
bb0054cd RD |
460 | self.SetSize(wxSize(400, 380)) |
461 | ||
462 | def OnCloseWindow(self, event): | |
463 | self.Destroy() | |
464 | ||
465 | def OnExit(self, event): | |
466 | self.Close(true) | |
467 | ||
468 | ||
469 | class TestApp(wxApp): | |
470 | def OnInit(self): | |
471 | frame = MainFrame() | |
472 | frame.Show(true) | |
473 | self.SetTopWindow(frame) | |
474 | return true | |
475 | ||
476 | app = TestApp(0) | |
477 | app.MainLoop() | |
478 | ||
479 | ||
480 | #---------------------------------------------------------------------- |