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