]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | #!/bin/env python |
2 | #---------------------------------------------------------------------------- | |
3 | # Name: test1.py | |
4 | # Purpose: A minimal wxPython program | |
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 RD |
16 | |
17 | ||
18 | #--------------------------------------------------------------------------- | |
19 | ||
20 | class MyFrame(wxFrame): | |
21 | def __init__(self, parent, id, title): | |
22 | wxFrame.__init__(self, parent, id, title, wxPoint(100, 100), wxSize(160, 100)) | |
23 | self.Connect(-1, -1, wxEVT_MOVE, self.OnMove) | |
24 | ||
25 | def OnCloseWindow(self, event): | |
26 | self.Destroy() | |
27 | ||
28 | def OnSize(self, event): | |
29 | size = event.GetSize() | |
30 | print "size:", size.width, size.height | |
31 | ||
32 | def OnMove(self, event): | |
7bf85405 RD |
33 | pos = event.GetPosition() |
34 | print "pos:", pos.x, pos.y | |
35 | ||
36 | ||
37 | ||
38 | #--------------------------------------------------------------------------- | |
39 | ||
40 | ||
41 | class MyApp(wxApp): | |
42 | def OnInit(self): | |
43 | frame = MyFrame(NULL, -1, "This is a test") | |
44 | frame.Show(true) | |
45 | self.SetTopWindow(frame) | |
46 | return true | |
47 | ||
48 | #--------------------------------------------------------------------------- | |
49 | ||
50 | ||
51 | def main(): | |
52 | app = MyApp(0) | |
53 | app.MainLoop() | |
54 | ||
55 | ||
56 | def t(): | |
57 | import pdb | |
58 | pdb.run('main()') | |
59 | ||
60 | if __name__ == '__main__': | |
61 | main() | |
62 | ||
63 | ||
64 | ||
65 | #---------------------------------------------------------------------------- | |
66 | # | |
67 | # $Log$ | |
b8b8dda7 RD |
68 | # Revision 1.3 1998/12/15 20:44:34 RD |
69 | # Changed the import semantics from "from wxPython import *" to "from | |
70 | # wxPython.wx import *" This is for people who are worried about | |
71 | # namespace pollution, they can use "from wxPython import wx" and then | |
72 | # prefix all the wxPython identifiers with "wx." | |
73 | # | |
74 | # Added wxTaskbarIcon for wxMSW. | |
75 | # | |
76 | # Made the events work for wxGrid. | |
77 | # | |
78 | # Added wxConfig. | |
79 | # | |
80 | # Added wxMiniFrame for wxGTK, (untested.) | |
81 | # | |
82 | # Changed many of the args and return values that were pointers to gdi | |
83 | # objects to references to reflect changes in the wxWindows API. | |
84 | # | |
85 | # Other assorted fixes and additions. | |
86 | # | |
9c039d08 | 87 | # Revision 1.2 1998/10/02 06:42:27 RD |
b8b8dda7 | 88 | # |
9c039d08 RD |
89 | # Version 0.4 of wxPython for MSW. |
90 | # | |
7bf85405 RD |
91 | # Revision 1.1 1998/08/09 08:28:05 RD |
92 | # Initial version | |
93 | # | |
94 | # |