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