]>
Commit | Line | Data |
---|---|---|
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 | ||
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 ) | |
11 | ||
12 | wxButton(self, wxID_OK, "OK", (10, 10)) | |
13 | wxButton(self, wxID_CANCEL, "Cancel", (50,50)) | |
14 | self.Centre( wxBOTH ) | |
15 | ||
16 | ||
17 | # This method is called automatically when the CLOSE event is | |
18 | # sent to this window | |
19 | #def OnCloseWindow(self, event): | |
20 | # self.Destroy() | |
21 | ||
22 | #def OnCloseMe(self, event): | |
23 | #self.Close(true) | |
24 | ||
25 | ||
26 | def main(): | |
27 | # Every wxWindows application must have a class derived from wxApp | |
28 | class App(wxApp): | |
29 | ||
30 | # wxWindows calls this method to initialize the application | |
31 | def OnInit(self): | |
32 | ||
33 | # Create an instance of our customized Frame class | |
34 | dialog = Dialog( NULL, 'test' ) | |
35 | dialog.ShowModal() | |
36 | print "got here" | |
37 | dialog.Destroy() | |
38 | ||
39 | # Tell wxWindows that this is our main window | |
40 | # Return a success flag | |
41 | return true | |
42 | ||
43 | app = App(0) # Create an instance of the application class | |
44 | app.MainLoop() # Tell it to start processing events | |
45 | ||
46 | ||
47 | ||
48 | if __name__ == '__main__': | |
49 | main() |