]>
Commit | Line | Data |
---|---|---|
f17fee68 RD |
1 | ## import all of the wxPython GUI package |
2 | from wxPython.wx import * | |
3 | ||
4 | ||
5 | ## Create a new frame class, derived from the wxPython Frame. | |
6 | class Dialog(wxDialog): | |
7 | ||
1e4a197e RD |
8 | def __init__(self, parent, title): |
9 | # First, call the base class' __init__ method to create the frame | |
10 | wxDialog.__init__( self, parent, -1, title, wxDefaultPosition, wxDefaultSize ) | |
f17fee68 RD |
11 | |
12 | wxButton(self, wxID_OK, "OK", (10, 10)) | |
13 | wxButton(self, wxID_CANCEL, "Cancel", (50,50)) | |
1e4a197e | 14 | self.Centre( wxBOTH ) |
f17fee68 RD |
15 | |
16 | ||
1e4a197e RD |
17 | # This method is called automatically when the CLOSE event is |
18 | # sent to this window | |
19 | #def OnCloseWindow(self, event): | |
20 | # self.Destroy() | |
f17fee68 | 21 | |
1e4a197e RD |
22 | #def OnCloseMe(self, event): |
23 | #self.Close(true) | |
f17fee68 RD |
24 | |
25 | ||
26 | def main(): | |
1e4a197e RD |
27 | # Every wxWindows application must have a class derived from wxApp |
28 | class App(wxApp): | |
f17fee68 | 29 | |
1e4a197e RD |
30 | # wxWindows calls this method to initialize the application |
31 | def OnInit(self): | |
f17fee68 | 32 | |
1e4a197e RD |
33 | # Create an instance of our customized Frame class |
34 | dialog = Dialog( NULL, 'test' ) | |
35 | dialog.ShowModal() | |
f17fee68 RD |
36 | print "got here" |
37 | dialog.Destroy() | |
38 | ||
1e4a197e RD |
39 | # Tell wxWindows that this is our main window |
40 | # Return a success flag | |
41 | return true | |
f17fee68 | 42 | |
1e4a197e RD |
43 | app = App(0) # Create an instance of the application class |
44 | app.MainLoop() # Tell it to start processing events | |
f17fee68 RD |
45 | |
46 | ||
47 | ||
48 | if __name__ == '__main__': | |
49 | main() |