]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | #!/bin/env python |
2 | #---------------------------------------------------------------------------- | |
3 | # Name: test4.py | |
4 | # Purpose: Testing lots of stuff, controls, window types, etc. | |
5 | # | |
6 | # Author: Robin Dunn | |
7 | # | |
8 | # Created: | |
9 | # RCS-ID: $Id$ | |
10 | # Copyright: (c) 1998 by Total Control Software | |
11 | # Licence: wxWindows license | |
12 | #---------------------------------------------------------------------------- | |
13 | ||
14 | ||
b8b8dda7 | 15 | from wxPython.wx import * |
7bf85405 | 16 | |
9c039d08 | 17 | import time |
7bf85405 RD |
18 | |
19 | #--------------------------------------------------------------------------- | |
20 | ||
21 | class TestSimpleControlsDlg(wxDialog): | |
22 | def __init__(self, parent, log): | |
23 | self.log = log | |
24 | wxDialog.__init__(self, parent, -1, "Test Simple Controls", | |
08127323 | 25 | wxDefaultPosition, wxSize(350, 350)) |
7bf85405 RD |
26 | |
27 | ||
62abd41e RD |
28 | sampleList = ["zero", "one", "two", "three", "four", "five", |
29 | "six", "seven", "eight", "nine", "ten"] | |
7bf85405 RD |
30 | |
31 | y_pos = 5 | |
32 | delta = 25 | |
33 | ||
34 | wxStaticText(self, -1, "wxTextCtrl", wxPoint(5, y_pos), wxSize(75, 20)) | |
35 | wxTextCtrl(self, 10, "", wxPoint(80, y_pos), wxSize(150, 20)) | |
36 | EVT_TEXT(self, 10, self.EvtText) | |
37 | y_pos = y_pos + delta | |
38 | ||
d5c9047a | 39 | wxCheckBox(self, 20, "wxCheckBox", wxPoint(80, y_pos), wxSize(150, 20), wxNO_BORDER) |
7bf85405 RD |
40 | EVT_CHECKBOX(self, 20, self.EvtCheckBox) |
41 | y_pos = y_pos + delta | |
42 | ||
08127323 | 43 | rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(80, y_pos), wxDefaultSize, |
022380e0 | 44 | sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER) |
7bf85405 | 45 | EVT_RADIOBOX(self, 30, self.EvtRadioBox) |
b8b8dda7 | 46 | width, height = rb.GetSizeTuple() |
7bf85405 RD |
47 | y_pos = y_pos + height + 5 |
48 | ||
49 | wxStaticText(self, -1, "wxChoice", wxPoint(5, y_pos), wxSize(75, 20)) | |
08127323 | 50 | wxChoice(self, 40, wxPoint(80, y_pos), wxSize(95, 20), #wxDefaultSize, |
7bf85405 RD |
51 | sampleList) |
52 | EVT_CHOICE(self, 40, self.EvtChoice) | |
53 | y_pos = y_pos + delta | |
54 | ||
55 | wxStaticText(self, -1, "wxComboBox", wxPoint(5, y_pos), wxSize(75, 18)) | |
56 | wxComboBox(self, 50, "default value", wxPoint(80, y_pos), wxSize(95, 20), | |
57 | sampleList, wxCB_DROPDOWN) | |
58 | EVT_COMBOBOX(self, 50, self.EvtComboBox) | |
59 | y_pos = y_pos + delta | |
60 | ||
61 | wxStaticText(self, -1, "wxListBox", wxPoint(5, y_pos), wxSize(75, 18)) | |
08127323 | 62 | lb = wxListBox(self, 60, wxPoint(80, y_pos), wxDefaultSize, |
7bf85405 RD |
63 | sampleList, wxLB_SINGLE) |
64 | EVT_LISTBOX(self, 60, self.EvtListBox) | |
65 | EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick) | |
66 | lb.SetSelection(0) | |
b8b8dda7 | 67 | width, height = lb.GetSizeTuple() |
7bf85405 RD |
68 | y_pos = y_pos + height + 5 |
69 | ||
70 | ||
71 | ||
72 | y_pos = y_pos + 15 | |
08127323 | 73 | wxButton(self, wxID_OK, ' OK ', wxPoint(80, y_pos), wxDefaultSize).SetDefault() |
7bf85405 RD |
74 | wxButton(self, wxID_CANCEL, ' Cancel ', wxPoint(140, y_pos)) |
75 | ||
76 | ||
77 | def EvtText(self, event): | |
78 | self.log.WriteText('EvtText: %s\n' % event.GetString()) | |
79 | ||
80 | def EvtCheckBox(self, event): | |
81 | self.log.WriteText('EvtCheckBox: %d\n' % event.GetInt()) | |
82 | ||
83 | def EvtRadioBox(self, event): | |
84 | self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt()) | |
85 | ||
86 | def EvtChoice(self, event): | |
87 | self.log.WriteText('EvtChoice: %s\n' % event.GetString()) | |
88 | ||
89 | def EvtComboBox(self, event): | |
90 | self.log.WriteText('EvtComboBox: %s\n' % event.GetString()) | |
91 | ||
92 | def EvtListBox(self, event): | |
93 | self.log.WriteText('EvtListBox: %s\n' % event.GetString()) | |
94 | ||
95 | def EvtListBoxDClick(self, event): | |
96 | self.log.WriteText('EvtListBoxDClick:\n') | |
97 | ||
98 | ||
99 | ||
100 | #--------------------------------------------------------------------------- | |
101 | ||
102 | class TestTimer(wxTimer): | |
103 | def __init__(self, log): | |
104 | wxTimer.__init__(self) | |
105 | self.log = log | |
106 | ||
107 | def Notify(self): | |
108 | wxBell() | |
109 | self.log.WriteText('beep!\n') | |
110 | ||
111 | ||
112 | #--------------------------------------------------------------------------- | |
113 | ||
114 | class TestLayoutConstraints(wxFrame): | |
115 | def __init__(self, parent): | |
116 | wxFrame.__init__(self, parent, -1, 'Test Layout Constraints', | |
08127323 | 117 | wxDefaultPosition, wxSize(500, 300)) |
7bf85405 RD |
118 | |
119 | self.SetAutoLayout(true) | |
120 | EVT_BUTTON(self, 100, self.OnButton) | |
121 | ||
08127323 | 122 | self.panelA = wxWindow(self, -1, wxDefaultPosition, wxDefaultSize, |
7bf85405 RD |
123 | wxSIMPLE_BORDER) |
124 | self.panelA.SetBackgroundColour(wxBLUE) | |
125 | lc = wxLayoutConstraints() | |
126 | lc.top.SameAs(self, wxTop, 10) | |
127 | lc.left.SameAs(self, wxLeft, 10) | |
128 | lc.bottom.SameAs(self, wxBottom, 10) | |
129 | lc.right.PercentOf(self, wxRight, 50) | |
130 | self.panelA.SetConstraints(lc) | |
131 | ||
08127323 | 132 | self.panelB = wxWindow(self, -1, wxDefaultPosition, wxDefaultSize, |
7bf85405 RD |
133 | wxSIMPLE_BORDER) |
134 | self.panelB.SetBackgroundColour(wxRED) | |
135 | lc = wxLayoutConstraints() | |
136 | lc.top.SameAs(self, wxTop, 10) | |
137 | lc.right.SameAs(self, wxRight, 10) | |
138 | lc.bottom.PercentOf(self, wxBottom, 30) | |
139 | lc.left.RightOf(self.panelA, 10) | |
140 | self.panelB.SetConstraints(lc) | |
141 | ||
08127323 | 142 | self.panelC = wxWindow(self, -1, wxDefaultPosition, wxDefaultSize, |
7bf85405 RD |
143 | wxSIMPLE_BORDER) |
144 | self.panelC.SetBackgroundColour(wxWHITE) | |
145 | lc = wxLayoutConstraints() | |
146 | lc.top.Below(self.panelB, 10) | |
147 | lc.right.SameAs(self, wxRight, 10) | |
148 | lc.bottom.SameAs(self, wxBottom, 10) | |
149 | lc.left.RightOf(self.panelA, 10) | |
150 | self.panelC.SetConstraints(lc) | |
151 | ||
152 | b = wxButton(self.panelA, 100, ' Panel A ') | |
153 | lc = wxLayoutConstraints() | |
154 | lc.centreX.SameAs (self.panelA, wxCentreX) | |
155 | lc.centreY.SameAs (self.panelA, wxCentreY) | |
156 | lc.height.AsIs () | |
157 | lc.width.PercentOf (self.panelA, wxWidth, 50) | |
158 | b.SetConstraints(lc); | |
159 | ||
160 | b = wxButton(self.panelB, 100, ' Panel B ') | |
161 | lc = wxLayoutConstraints() | |
162 | lc.top.SameAs (self.panelB, wxTop, 2) | |
163 | lc.right.SameAs (self.panelB, wxRight, 4) | |
164 | lc.height.AsIs () | |
165 | lc.width.AsIs () | |
166 | b.SetConstraints(lc); | |
167 | ||
08127323 | 168 | self.panelD = wxWindow(self.panelC, -1, wxDefaultPosition, wxDefaultSize, |
7bf85405 RD |
169 | wxSIMPLE_BORDER) |
170 | self.panelD.SetBackgroundColour(wxGREEN) | |
171 | wxStaticText(self.panelD, -1, "Panel D", wxPoint(4, 4)).SetBackgroundColour(wxGREEN) | |
172 | ||
173 | b = wxButton(self.panelC, 100, ' Panel C ') | |
174 | lc = wxLayoutConstraints() | |
175 | lc.top.Below (self.panelD) | |
176 | lc.left.RightOf (self.panelD) | |
177 | lc.height.AsIs () | |
178 | lc.width.AsIs () | |
179 | b.SetConstraints(lc); | |
180 | ||
181 | lc = wxLayoutConstraints() | |
182 | lc.bottom.PercentOf (self.panelC, wxHeight, 50) | |
183 | lc.right.PercentOf (self.panelC, wxWidth, 50) | |
184 | lc.height.SameAs (b, wxHeight) | |
185 | lc.width.SameAs (b, wxWidth) | |
186 | self.panelD.SetConstraints(lc); | |
187 | ||
188 | ||
189 | def OnButton(self, event): | |
190 | self.Close(true) | |
191 | ||
192 | ||
193 | def OnCloseWindow(self, event): | |
194 | self.Destroy() | |
195 | ||
196 | ||
197 | #--------------------------------------------------------------------------- | |
198 | ||
199 | class TestGrid(wxFrame): | |
b639c3c5 | 200 | def __init__(self, parent, log): |
7bf85405 | 201 | wxFrame.__init__(self, parent, -1, 'Test Grid', |
08127323 | 202 | wxDefaultPosition, wxSize(500, 300)) |
b639c3c5 | 203 | self.log = log |
7bf85405 RD |
204 | |
205 | grid = wxGrid(self, -1) | |
206 | ||
207 | grid.CreateGrid(16, 16) | |
208 | grid.SetColumnWidth(3, 200) | |
209 | grid.SetRowHeight(4, 45) | |
210 | grid.SetCellValue("First cell", 0, 0) | |
211 | grid.SetCellValue("Another cell", 1, 1) | |
212 | grid.SetCellValue("Yet another cell", 2, 2) | |
213 | grid.SetCellTextFont(wxFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0) | |
214 | grid.SetCellTextColour(wxRED, 1, 1) | |
215 | grid.SetCellBackgroundColour(wxCYAN, 2, 2) | |
216 | grid.UpdateDimensions() | |
217 | grid.AdjustScrollbars() | |
218 | ||
b639c3c5 RD |
219 | EVT_GRID_SELECT_CELL(grid, self.OnSelectCell) |
220 | EVT_GRID_CELL_CHANGE(grid, self.OnCellChange) | |
221 | EVT_GRID_CELL_LCLICK(grid, self.OnCellClick) | |
222 | EVT_GRID_LABEL_LCLICK(grid, self.OnLabelClick) | |
223 | ||
224 | ||
7bf85405 RD |
225 | |
226 | def OnCloseWindow(self, event): | |
227 | self.Destroy() | |
228 | ||
b639c3c5 RD |
229 | def OnSelectCell(self, event): |
230 | self.log.WriteText("OnSelectCell: (%d, %d)\n" % (event.m_row, event.m_col)) | |
231 | ||
232 | def OnCellChange(self, event): | |
233 | self.log.WriteText("OnCellChange: (%d, %d)\n" % (event.m_row, event.m_col)) | |
234 | ||
235 | def OnCellClick(self, event): | |
236 | self.log.WriteText("OnCellClick: (%d, %d)\n" % (event.m_row, event.m_col)) | |
237 | ||
238 | def OnLabelClick(self, event): | |
239 | self.log.WriteText("OnLabelClick: (%d, %d)\n" % (event.m_row, event.m_col)) | |
7bf85405 RD |
240 | |
241 | #--------------------------------------------------------------------------- | |
242 | ||
9c039d08 RD |
243 | |
244 | class ColoredPanel(wxWindow): | |
245 | def __init__(self, parent, color): | |
246 | wxWindow.__init__(self, parent, -1, | |
08127323 | 247 | wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER) |
9c039d08 RD |
248 | self.SetBackgroundColour(color) |
249 | ||
250 | ||
7bf85405 | 251 | class TestNotebookWindow(wxFrame): |
630d84f2 | 252 | def __init__(self, parent, log): |
7bf85405 | 253 | wxFrame.__init__(self, parent, -1, 'Test wxNotebook', |
08127323 | 254 | wxDefaultPosition, wxDefaultSize) |
7bf85405 RD |
255 | |
256 | nb = wxNotebook(self, -1) | |
257 | ||
9c039d08 | 258 | win = ColoredPanel(nb, wxBLUE) |
7bf85405 | 259 | nb.AddPage(win, "Blue") |
630d84f2 RD |
260 | st = wxStaticText(win, -1, |
261 | "You can put nearly any type of window here!", | |
262 | wxPoint(10, 10)) | |
263 | st.SetForegroundColour(wxWHITE) | |
264 | st.SetBackgroundColour(wxBLUE) | |
265 | st = wxStaticText(win, -1, | |
266 | "Check the next tab for an example...", | |
267 | wxPoint(10, 30)) | |
9c039d08 RD |
268 | st.SetForegroundColour(wxWHITE) |
269 | st.SetBackgroundColour(wxBLUE) | |
7bf85405 | 270 | |
630d84f2 RD |
271 | win = TestTreeCtrlPanel(nb, log) |
272 | nb.AddPage(win, "TreeCtrl") | |
273 | ||
af309447 RD |
274 | win = TestListCtrlPanel(nb, log) |
275 | nb.AddPage(win, "ListCtrl") | |
276 | ||
9c039d08 | 277 | win = ColoredPanel(nb, wxRED) |
7bf85405 RD |
278 | nb.AddPage(win, "Red") |
279 | ||
9c039d08 | 280 | win = ColoredPanel(nb, wxGREEN) |
7bf85405 RD |
281 | nb.AddPage(win, "Green") |
282 | ||
9c039d08 | 283 | win = ColoredPanel(nb, wxCYAN) |
7bf85405 RD |
284 | nb.AddPage(win, "Cyan") |
285 | ||
9c039d08 | 286 | win = ColoredPanel(nb, wxWHITE) |
7bf85405 RD |
287 | nb.AddPage(win, "White") |
288 | ||
9c039d08 | 289 | win = ColoredPanel(nb, wxBLACK) |
7bf85405 RD |
290 | nb.AddPage(win, "Black") |
291 | ||
9c039d08 | 292 | win = ColoredPanel(nb, wxNamedColour('MIDNIGHT BLUE')) |
7bf85405 RD |
293 | nb.AddPage(win, "MIDNIGHT BLUE") |
294 | ||
9c039d08 | 295 | win = ColoredPanel(nb, wxNamedColour('INDIAN RED')) |
7bf85405 RD |
296 | nb.AddPage(win, "INDIAN RED") |
297 | ||
298 | ||
299 | nb.SetSelection(0) | |
630d84f2 | 300 | self.SetSize(wxSize(350, 300)) # force a redraw so the notebook will draw |
9c039d08 RD |
301 | |
302 | ||
303 | def OnCloseWindow(self, event): | |
304 | self.Destroy() | |
305 | ||
306 | #--------------------------------------------------------------------------- | |
307 | ||
308 | class TestSplitterWindow(wxFrame): | |
309 | def __init__(self, parent): | |
310 | wxFrame.__init__(self, parent, -1, 'Test wxSplitterWindow', | |
08127323 | 311 | wxDefaultPosition, wxSize(500, 300)) |
9c039d08 RD |
312 | |
313 | splitter = wxSplitterWindow(self, -1) | |
314 | ||
315 | p1 = ColoredPanel(splitter, wxRED) | |
316 | wxStaticText(p1, -1, "Panel One", wxPoint(5,5)).SetBackgroundColour(wxRED) | |
317 | ||
318 | p2 = ColoredPanel(splitter, wxBLUE) | |
319 | wxStaticText(p2, -1, "Panel Two", wxPoint(5,5)).SetBackgroundColour(wxBLUE) | |
320 | ||
321 | splitter.SplitVertically(p1, p2) | |
322 | ||
323 | ||
324 | def OnCloseWindow(self, event): | |
325 | self.Destroy() | |
326 | ||
327 | ||
328 | #--------------------------------------------------------------------------- | |
329 | ||
330 | class CustomStatusBar(wxStatusBar): | |
331 | def __init__(self, parent): | |
332 | wxStatusBar.__init__(self, parent, -1) | |
333 | self.SetFieldsCount(3) | |
334 | ||
335 | self.SetStatusText("A Custom StatusBar...", 0) | |
336 | ||
337 | self.cb = wxCheckBox(self, 1001, "toggle clock") | |
338 | EVT_CHECKBOX(self, 1001, self.OnToggleClock) | |
339 | self.cb.SetValue(true) | |
340 | ||
341 | # figure out how tall to make it. | |
342 | dc = wxClientDC(self) | |
343 | dc.SetFont(self.GetFont()) | |
af309447 | 344 | (w,h) = dc.GetTextExtent('X') |
9c039d08 RD |
345 | h = int(h * 1.8) |
346 | self.SetSize(wxSize(100, h)) | |
347 | ||
348 | # start our timer | |
349 | self.timer = wxPyTimer(self.Notify) | |
350 | self.timer.Start(1000) | |
351 | self.Notify() | |
352 | ||
353 | ||
354 | # Time-out handler | |
355 | def Notify(self): | |
356 | t = time.localtime(time.time()) | |
357 | st = time.strftime("%d-%b-%Y %I:%M:%S", t) | |
358 | self.SetStatusText(st, 2) | |
359 | ||
360 | # the checkbox was clicked | |
361 | def OnToggleClock(self, event): | |
362 | if self.cb.GetValue(): | |
363 | self.timer.Start(1000) | |
364 | self.Notify() | |
365 | else: | |
366 | self.timer.Stop() | |
367 | ||
368 | # reposition the checkbox | |
369 | def OnSize(self, event): | |
370 | rect = self.GetFieldRect(1) | |
105e45b9 | 371 | print "%s, %s" % (rect.x, rect.y) |
9c039d08 RD |
372 | self.cb.SetPosition(wxPoint(rect.x+2, rect.y+2)) |
373 | self.cb.SetSize(wxSize(rect.width-4, rect.height-4)) | |
374 | ||
375 | ||
376 | ||
377 | class TestCustomStatusBar(wxFrame): | |
378 | def __init__(self, parent): | |
379 | wxFrame.__init__(self, parent, -1, 'Test Custom StatusBar', | |
08127323 | 380 | wxDefaultPosition, wxSize(500, 300)) |
b8b8dda7 | 381 | wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE")) |
7bf85405 | 382 | |
9c039d08 RD |
383 | self.sb = CustomStatusBar(self) |
384 | self.SetStatusBar(self.sb) | |
7bf85405 RD |
385 | |
386 | def OnCloseWindow(self, event): | |
9c039d08 | 387 | self.sb.timer.Stop() |
7bf85405 RD |
388 | self.Destroy() |
389 | ||
9c039d08 RD |
390 | |
391 | #--------------------------------------------------------------------------- | |
392 | ||
393 | class TestToolBar(wxFrame): | |
394 | def __init__(self, parent, log): | |
395 | wxFrame.__init__(self, parent, -1, 'Test ToolBar', | |
08127323 | 396 | wxDefaultPosition, wxSize(500, 300)) |
9c039d08 RD |
397 | self.log = log |
398 | ||
b8b8dda7 | 399 | wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE")) |
9c039d08 | 400 | |
b8b8dda7 | 401 | tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER) |
08127323 | 402 | #tb = wxToolBar(self, -1, wxDefaultPosition, wxDefaultSize, |
9c039d08 RD |
403 | # wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT) |
404 | #self.SetToolBar(tb) | |
405 | ||
08127323 RD |
406 | self.CreateStatusBar() |
407 | ||
9c039d08 | 408 | tb.AddTool(10, wxNoRefBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP), |
08127323 | 409 | wxNullBitmap, false, -1, -1, "New", "Long help for 'New'") |
9c039d08 RD |
410 | EVT_TOOL(self, 10, self.OnToolClick) |
411 | EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick) | |
412 | ||
413 | tb.AddTool(20, wxNoRefBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP), | |
2e850e68 | 414 | wxNullBitmap, false, -1, -1, "Open") |
9c039d08 RD |
415 | EVT_TOOL(self, 20, self.OnToolClick) |
416 | EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick) | |
417 | ||
418 | tb.AddSeparator() | |
419 | tb.AddTool(30, wxNoRefBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP), | |
2e850e68 | 420 | wxNullBitmap, false, -1, -1, "Copy") |
9c039d08 RD |
421 | EVT_TOOL(self, 30, self.OnToolClick) |
422 | EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick) | |
423 | ||
424 | tb.AddTool(40, wxNoRefBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP), | |
2e850e68 | 425 | wxNullBitmap, false, -1, -1, "Paste") |
9c039d08 RD |
426 | EVT_TOOL(self, 40, self.OnToolClick) |
427 | EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick) | |
428 | ||
429 | tb.AddSeparator() | |
430 | ||
431 | tb.AddTool(50, wxNoRefBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP), | |
2e850e68 | 432 | wxNullBitmap, true, -1, -1, "Toggle this") |
9c039d08 RD |
433 | EVT_TOOL(self, 50, self.OnToolClick) |
434 | EVT_TOOL_RCLICKED(self, 50, self.OnToolRClick) | |
435 | ||
436 | tb.AddTool(60, wxNoRefBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP), | |
437 | wxNoRefBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP), | |
438 | true, -1, -1, "Toggle with 2 bitmaps") | |
439 | EVT_TOOL(self, 60, self.OnToolClick) | |
440 | EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick) | |
441 | ||
442 | tb.Realize() | |
443 | ||
444 | ||
445 | def OnCloseWindow(self, event): | |
446 | self.Destroy() | |
447 | ||
448 | def OnToolClick(self, event): | |
449 | self.log.WriteText("tool %s clicked\n" % event.GetId()) | |
450 | ||
451 | def OnToolRClick(self, event): | |
452 | self.log.WriteText("tool %s right-clicked\n" % event.GetId()) | |
453 | ||
454 | ||
630d84f2 RD |
455 | #--------------------------------------------------------------------------- |
456 | ||
457 | class TestTreeCtrlPanel(wxPanel): | |
458 | def __init__(self, parent, log): | |
459 | wxPanel.__init__(self, parent, -1) | |
460 | ||
461 | self.log = log | |
462 | tID = 1101 | |
463 | ||
464 | self.tree = wxTreeCtrl(self, tID) | |
465 | root = self.tree.AddRoot("The Root Item") | |
466 | for x in range(10): | |
467 | child = self.tree.AppendItem(root, "Item %d" % x) | |
468 | for y in range(5): | |
469 | last = self.tree.AppendItem(child, "item %d-%s" % (x, chr(ord("a")+y))) | |
470 | ||
471 | self.tree.Expand(root) | |
472 | EVT_TREE_ITEM_EXPANDED (self, tID, self.OnItemExpanded) | |
473 | EVT_TREE_ITEM_COLLAPSED (self, tID, self.OnItemCollapsed) | |
474 | EVT_TREE_SEL_CHANGED (self, tID, self.OnSelChanged) | |
475 | ||
476 | ||
477 | def OnSize(self, event): | |
b8b8dda7 | 478 | w,h = self.GetClientSizeTuple() |
630d84f2 RD |
479 | self.tree.SetDimensions(0, 0, w, h) |
480 | ||
481 | ||
482 | def OnItemExpanded(self, event): | |
483 | item = event.GetItem() | |
484 | self.log.WriteText("OnItemExpanded: %s\n" % self.tree.GetItemText(item)) | |
485 | ||
486 | def OnItemCollapsed(self, event): | |
487 | item = event.GetItem() | |
488 | self.log.WriteText("OnItemCollapsed: %s\n" % self.tree.GetItemText(item)) | |
489 | ||
490 | def OnSelChanged(self, event): | |
491 | item = event.GetItem() | |
492 | self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(item)) | |
493 | ||
494 | ||
495 | ||
496 | ||
497 | class TestTreeCtrl(wxFrame): | |
498 | def __init__(self, parent, log): | |
499 | wxFrame.__init__(self, parent, -1, 'Test TreeCtrl', | |
08127323 | 500 | wxDefaultPosition, wxSize(250, 300)) |
630d84f2 RD |
501 | |
502 | p = TestTreeCtrlPanel(self, log) | |
503 | ||
504 | ||
af309447 RD |
505 | #--------------------------------------------------------------------------- |
506 | ||
507 | class TestListCtrlPanel(wxPanel): | |
508 | def __init__(self, parent, log): | |
509 | wxPanel.__init__(self, parent, -1) | |
510 | ||
511 | self.log = log | |
512 | tID = 1101 | |
513 | ||
514 | self.il = wxImageList(16, 16) | |
515 | idx1 = self.il.Add(wxNoRefBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP)) | |
516 | ||
517 | self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize, | |
518 | wxLC_REPORT|wxSUNKEN_BORDER) | |
519 | self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL) | |
520 | ||
521 | self.list.SetToolTip(wxToolTip("This is a ToolTip!")) | |
522 | wxToolTip_Enable(true) | |
523 | ||
524 | self.list.InsertColumn(0, "Column 0") | |
525 | self.list.InsertColumn(1, "Column 1") | |
526 | self.list.InsertColumn(2, "One More Column (2)") | |
527 | for x in range(50): | |
528 | self.list.InsertImageStringItem(x, "This is item %d" % x, idx1) | |
529 | self.list.SetStringItem(x, 1, "Col 1, item %d" % x) | |
530 | self.list.SetStringItem(x, 2, "item %d in column 2" % x) | |
531 | ||
532 | self.list.SetColumnWidth(0, wxLIST_AUTOSIZE) | |
533 | self.list.SetColumnWidth(1, wxLIST_AUTOSIZE) | |
534 | self.list.SetColumnWidth(2, wxLIST_AUTOSIZE) | |
535 | ||
536 | ||
537 | def OnSize(self, event): | |
538 | w,h = self.GetClientSizeTuple() | |
539 | self.list.SetDimensions(0, 0, w, h) | |
540 | ||
541 | ||
542 | ||
543 | ||
544 | class TestListCtrl(wxFrame): | |
545 | def __init__(self, parent, log): | |
546 | wxFrame.__init__(self, parent, -1, 'Test ListCtrl', | |
547 | wxDefaultPosition, wxSize(250, 300)) | |
548 | ||
549 | p = TestListCtrlPanel(self, log) | |
550 | ||
551 | ||
08127323 RD |
552 | #--------------------------------------------------------------------------- |
553 | ||
554 | class TestSashWindow(wxMDIParentFrame): | |
555 | NEW_WINDOW = 5000 | |
556 | TOGGLE_WINDOW = 5001 | |
557 | QUIT = 5002 | |
558 | ID_WINDOW_TOP = 5100 | |
559 | ID_WINDOW_LEFT1 = 5101 | |
560 | ID_WINDOW_LEFT2 = 5102 | |
561 | ID_WINDOW_BOTTOM = 5103 | |
562 | ||
563 | ||
564 | def __init__(self, parent, log): | |
565 | wxMDIParentFrame.__init__(self, parent, -1, 'Test Sash Window', | |
566 | wxDefaultPosition, wxSize(250, 300)) | |
567 | ||
568 | self.log = log | |
569 | menu = wxMenu() | |
570 | menu.Append(self.NEW_WINDOW, "&New Window") | |
571 | menu.Append(self.TOGGLE_WINDOW, "&Toggle window") | |
572 | menu.Append(self.QUIT, "E&xit") | |
573 | ||
574 | menubar = wxMenuBar() | |
575 | menubar.Append(menu, "&File") | |
576 | ||
577 | self.SetMenuBar(menubar) | |
578 | self.CreateStatusBar() | |
579 | ||
580 | EVT_MENU(self, self.NEW_WINDOW, self.OnNewWindow) | |
581 | EVT_MENU(self, self.TOGGLE_WINDOW, self.OnToggleWindow) | |
582 | EVT_MENU(self, self.QUIT, self.OnQuit) | |
583 | ||
584 | EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP, | |
585 | self.ID_WINDOW_BOTTOM, self.OnSashDrag) | |
586 | ||
587 | ||
588 | # Create some layout windows | |
589 | # A window like a toolbar | |
590 | win = wxSashLayoutWindow(self, self.ID_WINDOW_TOP, wxDefaultPosition, | |
591 | wxSize(200, 30), wxNO_BORDER|wxSW_3D) | |
592 | win.SetDefaultSize(wxSize(1000, 30)) | |
593 | win.SetOrientation(wxLAYOUT_HORIZONTAL) | |
594 | win.SetAlignment(wxLAYOUT_TOP) | |
595 | win.SetBackgroundColour(wxColour(255, 0, 0)) | |
596 | win.SetSashVisible(wxSASH_BOTTOM, true) | |
597 | ||
598 | self.topWindow = win | |
599 | ||
600 | ||
601 | # A window like a statusbar | |
602 | win = wxSashLayoutWindow(self, self.ID_WINDOW_BOTTOM, | |
603 | wxDefaultPosition, wxSize(200, 30), | |
604 | wxNO_BORDER|wxSW_3D) | |
605 | win.SetDefaultSize(wxSize(1000, 30)) | |
606 | win.SetOrientation(wxLAYOUT_HORIZONTAL) | |
607 | win.SetAlignment(wxLAYOUT_BOTTOM) | |
608 | win.SetBackgroundColour(wxColour(0, 0, 255)) | |
609 | win.SetSashVisible(wxSASH_TOP, true) | |
610 | ||
611 | self.bottomWindow = win | |
612 | ||
613 | ||
614 | # A window to the left of the client window | |
615 | win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT1, | |
616 | wxDefaultPosition, wxSize(200, 30), | |
617 | wxNO_BORDER|wxSW_3D) | |
618 | win.SetDefaultSize(wxSize(120, 1000)) | |
619 | win.SetOrientation(wxLAYOUT_VERTICAL) | |
620 | win.SetAlignment(wxLAYOUT_LEFT) | |
621 | win.SetBackgroundColour(wxColour(0, 255, 0)) | |
622 | win.SetSashVisible(wxSASH_RIGHT, TRUE) | |
623 | win.SetExtraBorderSize(10) | |
624 | ||
625 | textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize, | |
626 | wxTE_MULTILINE|wxSUNKEN_BORDER) | |
627 | textWindow.SetValue("A help window") | |
628 | ||
629 | self.leftWindow1 = win | |
630 | ||
631 | ||
632 | # Another window to the left of the client window | |
633 | win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT2, | |
634 | wxDefaultPosition, wxSize(200, 30), | |
635 | wxNO_BORDER|wxSW_3D) | |
636 | win.SetDefaultSize(wxSize(120, 1000)) | |
637 | win.SetOrientation(wxLAYOUT_VERTICAL) | |
638 | win.SetAlignment(wxLAYOUT_LEFT) | |
639 | win.SetBackgroundColour(wxColour(0, 255, 255)) | |
640 | win.SetSashVisible(wxSASH_RIGHT, TRUE) | |
641 | ||
642 | self.leftWindow2 = win | |
643 | ||
644 | ||
645 | def OnNewWindow(self, event): | |
646 | pass | |
647 | ||
648 | def OnToggleWindow(self, event): | |
649 | pass | |
650 | ||
651 | def OnQuit(self, event): | |
652 | self.Close(true) | |
653 | ||
654 | def OnSashDrag(self, event): | |
655 | if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE: | |
656 | return | |
657 | ||
658 | eID = event.GetId() | |
659 | if eID == self.ID_WINDOW_TOP: | |
660 | self.topWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height)) | |
661 | ||
662 | elif eID == self.ID_WINDOW_LEFT1: | |
663 | self.leftWindow1.SetDefaultSize(wxSize(event.GetDragRect().width, 1000)) | |
664 | ||
665 | ||
666 | elif eID == self.ID_WINDOW_LEFT2: | |
667 | self.leftWindow2.SetDefaultSize(wxSize(event.GetDragRect().width, 1000)) | |
668 | ||
669 | elif eID == self.ID_WINDOW_BOTTOM: | |
670 | self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height)) | |
671 | ||
672 | wxLayoutAlgorithm().LayoutMDIFrame(self) | |
673 | ||
674 | # Leaves bits of itself behind sometimes | |
675 | self.GetClientWindow().Refresh() | |
676 | ||
677 | ||
678 | def OnSize(self, event): | |
679 | wxLayoutAlgorithm().LayoutMDIFrame(self) | |
680 | ||
9c039d08 RD |
681 | #--------------------------------------------------------------------------- |
682 | #--------------------------------------------------------------------------- | |
7bf85405 RD |
683 | #--------------------------------------------------------------------------- |
684 | ||
685 | class AppFrame(wxFrame): | |
686 | def __init__(self, parent, id, title): | |
08127323 | 687 | wxFrame.__init__(self, parent, id, title, wxDefaultPosition, |
7bf85405 | 688 | wxSize(420, 200)) |
f57d7932 RD |
689 | if wxPlatform == '__WXMSW__': |
690 | self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO) | |
691 | self.SetIcon(self.icon) | |
7bf85405 RD |
692 | |
693 | self.mainmenu = wxMenuBar() | |
694 | menu = wxMenu() | |
695 | menu.Append(200, 'E&xit', 'Get the heck outta here!') | |
696 | EVT_MENU(self, 200, self.OnFileExit) | |
697 | self.mainmenu.Append(menu, '&File') | |
698 | ||
699 | menu = self.MakeTestsMenu() | |
700 | self.mainmenu.Append(menu, '&Tests') | |
701 | self.SetMenuBar(self.mainmenu) | |
702 | ||
08127323 | 703 | self.log = wxTextCtrl(self, -1, '', wxDefaultPosition, wxDefaultSize, |
7bf85405 RD |
704 | wxTE_MULTILINE|wxTE_READONLY) |
705 | self.log.WriteText('Test 4:\n') | |
706 | (w, self.charHeight) = self.log.GetTextExtent('X') | |
707 | ||
708 | ||
709 | def MakeTestsMenu(self): | |
710 | menu = wxMenu() | |
711 | ||
712 | mID = NewId() | |
713 | menu.Append(mID, '&Simple Controls') | |
714 | EVT_MENU(self, mID, self.OnTestSimpleControls) | |
715 | ||
716 | mID = NewId() | |
717 | menu.Append(mID, '&Timer', '', true) | |
718 | EVT_MENU(self, mID, self.OnTestTimer) | |
719 | self.timerID = mID | |
720 | self.timer = None | |
721 | ||
722 | mID = NewId() | |
723 | menu.Append(mID, '&Layout Constraints') | |
724 | EVT_MENU(self, mID, self.OnTestLayoutConstraints) | |
725 | ||
726 | mID = NewId() | |
727 | menu.Append(mID, '&Grid') | |
728 | EVT_MENU(self, mID, self.OnTestGrid) | |
729 | ||
730 | ||
731 | smenu = wxMenu() # make a sub-menu | |
732 | ||
733 | mID = NewId() | |
734 | smenu.Append(mID, '&Colour') | |
735 | EVT_MENU(self, mID, self.OnTestColourDlg) | |
736 | ||
737 | mID = NewId() | |
738 | smenu.Append(mID, '&Directory') | |
739 | EVT_MENU(self, mID, self.OnTestDirDlg) | |
740 | ||
741 | mID = NewId() | |
742 | smenu.Append(mID, '&File') | |
743 | EVT_MENU(self, mID, self.OnTestFileDlg) | |
744 | ||
745 | mID = NewId() | |
746 | smenu.Append(mID, '&Single Choice') | |
747 | EVT_MENU(self, mID, self.OnTestSingleChoiceDlg) | |
748 | ||
749 | mID = NewId() | |
750 | smenu.Append(mID, '&TextEntry') | |
751 | EVT_MENU(self, mID, self.OnTestTextEntryDlg) | |
752 | ||
753 | mID = NewId() | |
754 | smenu.Append(mID, '&Font') | |
755 | EVT_MENU(self, mID, self.OnTestFontDlg) | |
756 | ||
757 | mID = NewId() | |
758 | smenu.Append(mID, '&PageSetup') | |
759 | EVT_MENU(self, mID, self.OnTestPageSetupDlg) | |
760 | ||
761 | mID = NewId() | |
762 | smenu.Append(mID, '&Print') | |
763 | EVT_MENU(self, mID, self.OnTestPrintDlg) | |
764 | ||
765 | mID = NewId() | |
766 | smenu.Append(mID, '&Message') | |
767 | EVT_MENU(self, mID, self.OnTestMessageDlg) | |
768 | ||
769 | ||
770 | menu.AppendMenu(NewId(), '&Common Dialogs', smenu) | |
771 | ||
772 | ||
773 | mID = NewId() | |
774 | menu.Append(mID, '&Notebook') | |
775 | EVT_MENU(self, mID, self.OnTestNotebook) | |
776 | ||
9c039d08 RD |
777 | mID = NewId() |
778 | menu.Append(mID, '&Splitter Window') | |
779 | EVT_MENU(self, mID, self.OnTestSplitter) | |
780 | ||
781 | mID = NewId() | |
782 | menu.Append(mID, '&Custom StatusBar') | |
783 | EVT_MENU(self, mID, self.OnTestCustomStatusBar) | |
784 | ||
785 | mID = NewId() | |
786 | menu.Append(mID, '&ToolBar') | |
787 | EVT_MENU(self, mID, self.OnTestToolBar) | |
788 | ||
630d84f2 RD |
789 | mID = NewId() |
790 | menu.Append(mID, 'T&ree Control') | |
791 | EVT_MENU(self, mID, self.OnTestTreeCtrl) | |
792 | ||
af309447 RD |
793 | mID = NewId() |
794 | menu.Append(mID, '&List Control') | |
795 | EVT_MENU(self, mID, self.OnTestListCtrl) | |
796 | ||
08127323 RD |
797 | mID = NewId() |
798 | menu.Append(mID, 'S&ash Window and Layout Algorithm') | |
799 | EVT_MENU(self, mID, self.OnTestSashWindow) | |
800 | ||
7bf85405 RD |
801 | return menu |
802 | ||
803 | ||
804 | ||
805 | ||
806 | def WriteText(self, str): | |
807 | self.log.WriteText(str) | |
21f4bf45 | 808 | if wxPlatform == '__WXMSW__': |
b8b8dda7 | 809 | w, h = self.log.GetClientSizeTuple() |
21f4bf45 RD |
810 | numLines = h/self.charHeight |
811 | x, y = self.log.PositionToXY(self.log.GetLastPosition()) | |
812 | self.log.ShowPosition(self.log.XYToPosition(x, y-numLines+1)) | |
7bf85405 RD |
813 | |
814 | def OnFileExit(self, event): | |
815 | self.Close() | |
816 | ||
817 | def OnCloseWindow(self, event): | |
818 | self.Destroy() | |
819 | ||
820 | ||
821 | ||
822 | ||
823 | def OnTestSimpleControls(self, event): | |
824 | dlg = TestSimpleControlsDlg(self, self) | |
7bf85405 | 825 | dlg.Centre() |
f57d7932 | 826 | dlg.ShowModal() |
7bf85405 RD |
827 | dlg.Destroy() |
828 | ||
829 | def OnTestTimer(self, event): | |
830 | if self.timer: | |
831 | self.mainmenu.Check(self.timerID, false) | |
832 | self.timer.Stop() | |
833 | self.timer = None | |
834 | else: | |
835 | self.mainmenu.Check(self.timerID, true) | |
836 | self.timer = TestTimer(self) | |
837 | self.timer.Start(1000) | |
838 | ||
839 | def OnTestLayoutConstraints(self, event): | |
840 | win = TestLayoutConstraints(self) | |
841 | win.Show(true) | |
842 | ||
843 | def OnTestGrid(self, event): | |
b639c3c5 | 844 | win = TestGrid(self, self) |
7bf85405 RD |
845 | win.Show(true) |
846 | win.SetSize(wxSize(505, 300)) # have to force a resize, or the grid doesn't | |
847 | # show up for some reason.... | |
848 | ||
849 | def OnTestColourDlg(self, event): | |
850 | data = wxColourData() | |
851 | data.SetChooseFull(true) | |
852 | dlg = wxColourDialog(self, data) | |
853 | if dlg.ShowModal() == wxID_OK: | |
854 | data = dlg.GetColourData() | |
855 | self.log.WriteText('You selected: %s\n' % str(data.GetColour().Get())) | |
856 | dlg.Destroy() | |
857 | ||
858 | def OnTestDirDlg(self, event): | |
859 | dlg = wxDirDialog(self) | |
860 | if dlg.ShowModal() == wxID_OK: | |
861 | self.log.WriteText('You selected: %s\n' % dlg.GetPath()) | |
862 | dlg.Destroy() | |
863 | ||
864 | def OnTestFileDlg(self, event): | |
865 | dlg = wxFileDialog(self, "Choose a file", ".", "", "*.*", wxOPEN) | |
866 | if dlg.ShowModal() == wxID_OK: | |
867 | self.log.WriteText('You selected: %s\n' % dlg.GetPath()) | |
868 | dlg.Destroy() | |
869 | ||
870 | def OnTestSingleChoiceDlg(self, event): | |
871 | dlg = wxSingleChoiceDialog(self, 'Test Single Choice', 'The Caption', | |
872 | ['zero', 'one', 'two', 'three', 'four', 'five', | |
873 | 'six', 'seven', 'eight']) | |
874 | if dlg.ShowModal() == wxID_OK: | |
875 | self.log.WriteText('You selected: %s\n' % dlg.GetStringSelection()) | |
876 | dlg.Destroy() | |
877 | ||
878 | def OnTestTextEntryDlg(self, event): | |
879 | dlg = wxTextEntryDialog(self, 'What is your favorite programming language?', | |
880 | 'Duh??', 'Python') | |
881 | #dlg.SetValue("Python is the best!") #### this doesn't work? | |
882 | if dlg.ShowModal() == wxID_OK: | |
883 | self.log.WriteText('You entered: %s\n' % dlg.GetValue()) | |
884 | dlg.Destroy() | |
885 | ||
886 | ||
887 | def OnTestFontDlg(self, event): | |
888 | dlg = wxFontDialog(self) | |
889 | if dlg.ShowModal() == wxID_OK: | |
890 | data = dlg.GetFontData() | |
891 | font = data.GetChosenFont() | |
892 | self.log.WriteText('You selected: "%s", %d points, color %s\n' % | |
893 | (font.GetFaceName(), font.GetPointSize(), | |
894 | data.GetColour().Get())) | |
895 | dlg.Destroy() | |
896 | ||
897 | ||
898 | def OnTestPageSetupDlg(self, event): | |
899 | data = wxPageSetupData() | |
900 | data.SetMarginTopLeft(wxPoint(50,50)) | |
901 | data.SetMarginBottomRight(wxPoint(50,50)) | |
902 | dlg = wxPageSetupDialog(self, data) | |
903 | if dlg.ShowModal() == wxID_OK: | |
904 | data = dlg.GetPageSetupData() | |
905 | tl = data.GetMarginTopLeft() | |
906 | br = data.GetMarginBottomRight() | |
907 | self.log.WriteText('Margins are: %s %s\n' % (str(tl), str(br))) | |
908 | dlg.Destroy() | |
909 | ||
910 | def OnTestPrintDlg(self, event): | |
911 | data = wxPrintData() | |
912 | data.EnablePrintToFile(true) | |
913 | data.EnablePageNumbers(true) | |
914 | data.EnableSelection(true) | |
915 | dlg = wxPrintDialog(self, data) | |
916 | if dlg.ShowModal() == wxID_OK: | |
917 | self.log.WriteText('\n') | |
918 | dlg.Destroy() | |
919 | ||
920 | def OnTestMessageDlg(self, event): | |
921 | dlg = wxMessageDialog(self, 'Hello from Python and wxWindows!', | |
922 | 'A Message Box', wxOK | wxICON_INFORMATION) | |
923 | dlg.ShowModal() | |
924 | dlg.Destroy() | |
925 | ||
926 | ||
927 | def OnTestNotebook(self, event): | |
630d84f2 | 928 | win = TestNotebookWindow(self, self) |
7bf85405 RD |
929 | win.Show(true) |
930 | ||
9c039d08 RD |
931 | def OnTestSplitter(self, event): |
932 | win = TestSplitterWindow(self) | |
933 | win.Show(true) | |
934 | ||
935 | def OnTestCustomStatusBar(self, event): | |
936 | win = TestCustomStatusBar(self) | |
937 | win.Show(true) | |
938 | ||
939 | def OnTestToolBar(self, event): | |
940 | win = TestToolBar(self, self) | |
941 | win.Show(true) | |
942 | ||
630d84f2 RD |
943 | def OnTestTreeCtrl(self, event): |
944 | win = TestTreeCtrl(self, self) | |
945 | win.Show(true) | |
946 | ||
af309447 RD |
947 | def OnTestListCtrl(self, event): |
948 | win = TestListCtrl(self, self) | |
949 | win.Show(true) | |
950 | ||
08127323 RD |
951 | def OnTestSashWindow(self, event): |
952 | win = TestSashWindow(self, self) | |
953 | win.Show(true) | |
9c039d08 | 954 | |
7bf85405 RD |
955 | #--------------------------------------------------------------------------- |
956 | ||
957 | ||
958 | class MyApp(wxApp): | |
959 | def OnInit(self): | |
960 | frame = AppFrame(NULL, -1, "Test 4: (lots of little tests...)") | |
961 | frame.Show(true) | |
962 | self.SetTopWindow(frame) | |
963 | return true | |
964 | ||
965 | #--------------------------------------------------------------------------- | |
966 | ||
967 | ||
968 | def main(): | |
969 | app = MyApp(0) | |
970 | app.MainLoop() | |
971 | ||
972 | ||
973 | def t(): | |
974 | import pdb | |
975 | pdb.run('main()') | |
976 | ||
21f4bf45 RD |
977 | |
978 | # for focused testing... | |
0d6f9504 | 979 | def main2(): |
21f4bf45 RD |
980 | class T2App(wxApp): |
981 | def OnInit(self): | |
982 | frame = TestLayoutConstraints(NULL) | |
983 | frame.Show(true) | |
984 | self.SetTopWindow(frame) | |
0d6f9504 | 985 | return true |
21f4bf45 RD |
986 | |
987 | app = T2App(0) | |
988 | app.MainLoop() | |
989 | ||
0d6f9504 RD |
990 | def t2(): |
991 | import pdb | |
992 | pdb.run('main2()') | |
993 | ||
21f4bf45 RD |
994 | |
995 | ||
7bf85405 RD |
996 | if __name__ == '__main__': |
997 | main() | |
998 | ||
999 | ||
1000 | #---------------------------------------------------------------------------- | |
1001 | # | |
1002 | # $Log$ | |
62abd41e RD |
1003 | # Revision 1.15 1999/03/05 07:23:42 RD |
1004 | # Minor wxPython changes for wxWin 2.0 | |
1005 | # | |
022380e0 | 1006 | # Revision 1.14 1999/02/27 04:20:50 RD |
62abd41e | 1007 | # |
022380e0 RD |
1008 | # minor tweaks for testing |
1009 | # | |
af309447 RD |
1010 | # Revision 1.13 1999/02/20 09:04:44 RD |
1011 | # Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a | |
1012 | # window handle. If you can get the window handle into the python code, | |
1013 | # it should just work... More news on this later. | |
1014 | # | |
1015 | # Added wxImageList, wxToolTip. | |
1016 | # | |
1017 | # Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the | |
1018 | # wxRegConfig class. | |
1019 | # | |
1020 | # As usual, some bug fixes, tweaks, etc. | |
1021 | # | |
08127323 | 1022 | # Revision 1.12 1999/01/30 07:31:33 RD |
af309447 | 1023 | # |
08127323 RD |
1024 | # Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. |
1025 | # | |
1026 | # Various cleanup, tweaks, minor additions, etc. to maintain | |
1027 | # compatibility with the current wxWindows. | |
1028 | # | |
2e850e68 HH |
1029 | # Revision 1.11 1999/01/29 16:17:59 HH |
1030 | # In test4's toolbar sample, changed NULL to wxNullBitmap to prevent SIGSEVS | |
1031 | # with wxGTK. The sample works now. | |
1032 | # | |
105e45b9 | 1033 | # Revision 1.10 1998/12/16 22:12:47 RD |
2e850e68 | 1034 | # |
105e45b9 RD |
1035 | # Tweaks needed to be able to build wxPython with wxGTK. |
1036 | # | |
b8b8dda7 RD |
1037 | # Revision 1.9 1998/12/15 20:44:35 RD |
1038 | # Changed the import semantics from "from wxPython import *" to "from | |
1039 | # wxPython.wx import *" This is for people who are worried about | |
1040 | # namespace pollution, they can use "from wxPython import wx" and then | |
1041 | # prefix all the wxPython identifiers with "wx." | |
1042 | # | |
1043 | # Added wxTaskbarIcon for wxMSW. | |
1044 | # | |
1045 | # Made the events work for wxGrid. | |
1046 | # | |
1047 | # Added wxConfig. | |
1048 | # | |
1049 | # Added wxMiniFrame for wxGTK, (untested.) | |
1050 | # | |
1051 | # Changed many of the args and return values that were pointers to gdi | |
1052 | # objects to references to reflect changes in the wxWindows API. | |
1053 | # | |
1054 | # Other assorted fixes and additions. | |
1055 | # | |
b639c3c5 | 1056 | # Revision 1.8 1998/11/25 08:47:11 RD |
b8b8dda7 | 1057 | # |
b639c3c5 RD |
1058 | # Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon |
1059 | # Added events for wxGrid | |
1060 | # Other various fixes and additions | |
1061 | # | |
630d84f2 | 1062 | # Revision 1.7 1998/11/11 03:13:19 RD |
b639c3c5 | 1063 | # |
630d84f2 RD |
1064 | # Additions for wxTreeCtrl |
1065 | # | |
d5c9047a RD |
1066 | # Revision 1.6 1998/10/20 06:45:33 RD |
1067 | # New wxTreeCtrl wrappers (untested) | |
1068 | # some changes in helpers | |
1069 | # etc. | |
1070 | # | |
9c039d08 | 1071 | # Revision 1.5 1998/10/02 06:42:28 RD |
d5c9047a | 1072 | # |
9c039d08 RD |
1073 | # Version 0.4 of wxPython for MSW. |
1074 | # | |
0d6f9504 RD |
1075 | # Revision 1.4 1998/08/27 21:59:51 RD |
1076 | # Some chicken-and-egg problems solved for wxPython on wxGTK | |
1077 | # | |
21f4bf45 RD |
1078 | # Revision 1.3 1998/08/27 00:01:17 RD |
1079 | # - more tweaks | |
1080 | # - have discovered some problems but not yet discovered solutions... | |
1081 | # | |
f57d7932 RD |
1082 | # Revision 1.2 1998/08/22 19:51:18 RD |
1083 | # some tweaks for wxGTK | |
1084 | # | |
7bf85405 RD |
1085 | # Revision 1.1 1998/08/09 08:28:05 RD |
1086 | # Initial version | |
1087 | # | |
1088 | # |