]>
Commit | Line | Data |
---|---|---|
1 | from wxPython.wx import * | |
2 | ||
3 | class Test: | |
4 | def __init__(self): | |
5 | self.panel = wxPanel(frame, -1) | |
6 | self.box = wxListBox(self.panel, 100, wxPoint(10,10), | |
7 | wxSize(300,100), [], wxLB_SINGLE|wxLB_SORT) | |
8 | self.text = wxTextCtrl(self.panel, 110,'', wxPoint(310,10), | |
9 | wxSize(300,100),wxTE_MULTILINE|wxTE_READONLY) | |
10 | self.FillList() | |
11 | ||
12 | def FillList(self): | |
13 | line = 'This is a test' | |
14 | self.box.Append(line) | |
15 | self.text.AppendText(line) | |
16 | ||
17 | def OnCloseWindow(self, event): | |
18 | self.panel.Close(true) | |
19 | ||
20 | class MyApp(wxApp): | |
21 | def OnInit(self): | |
22 | global frame | |
23 | frame = wxFrame(NULL,-1,'Main',wxDefaultPosition,wxSize(630,150)) | |
24 | test = Test() | |
25 | frame.Show(true) | |
26 | self.SetTopWindow(frame) | |
27 | return true | |
28 | ||
29 | def OnCloseWindow(self, event): | |
30 | self.Destroy() | |
31 | ||
32 | if __name__ == '__main__': | |
33 | app = MyApp(0) | |
34 | app.MainLoop() | |
35 | ||
36 | ||
37 |