]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/tests/test1.py
Corrected link error for missing wxRegTipProvider::GetTip by giving it
[wxWidgets.git] / utils / wxPython / tests / test1.py
1 #!/bin/env python
2 #----------------------------------------------------------------------------
3 # Name: test1.py
4 # Purpose: A minimal wxPython program
5 #
6 # Author: Robin Dunn
7 #
8 # Created: A long time ago, in a galaxy far, far away...
9 # RCS-ID: $Id$
10 # Copyright: (c) 1998 by Total Control Software
11 # Licence: wxWindows license
12 #----------------------------------------------------------------------------
13
14
15 <<<<<<< test1.py
16 <<<<<<< test1.py
17 #from wxPython import *
18 from wxpc import *
19 =======
20 =======
21 ## import all of the wxPython GUI package
22 >>>>>>> 1.4
23 from wxPython.wx import *
24 >>>>>>> 1.3
25
26 #---------------------------------------------------------------------------
27
28 ## Create a new frame class, derived from the wxPython Frame.
29 class MyFrame(wxFrame):
30
31 def __init__(self, parent, id, title):
32 # First, call the base class' __init__ method to create the frame
33 wxFrame.__init__(self, parent, id, title,
34 wxPoint(100, 100), wxSize(160, 100))
35
36 # Associate some events with methods of this class
37 EVT_SIZE(self, self.OnSize)
38 EVT_MOVE(self, self.OnMove)
39
40
41 # This method is called automatically when the CLOSE event is
42 # sent to this window
43 def OnCloseWindow(self, event):
44 # tell the window to kill itself
45 self.Destroy()
46
47
48 # This method is called by the System when the window is resized,
49 # because of the association above.
50 def OnSize(self, event):
51 size = event.GetSize()
52 print "size:", size.width, size.height
53
54 # This method is called by the System when the window is moved,
55 # because of the association above.
56 def OnMove(self, event):
57 pos = event.GetPosition()
58 print "pos:", pos.x, pos.y
59
60
61
62 #---------------------------------------------------------------------------
63
64
65 <<<<<<< test1.py
66 =======
67 # Every wxWindows application must have a class derived from wxApp
68 >>>>>>> 1.4
69 class MyApp(wxApp):
70
71 # wxWindows calls this method to initialize the application
72 def OnInit(self):
73
74 # Create an instance of our customized Frame class
75 frame = MyFrame(NULL, -1, "This is a test")
76 frame.Show(true)
77
78 # Tell wxWindows that this is our main window
79 self.SetTopWindow(frame)
80
81 # Return a success flag
82 return true
83
84 #---------------------------------------------------------------------------
85
86 <<<<<<< test1.py
87
88 def main():
89 app = MyApp(0)
90 app.MainLoop()
91
92
93 def t():
94 import pdb
95 pdb.run('main()')
96 =======
97 >>>>>>> 1.4
98
99 <<<<<<< test1.py
100 if __name__ == '__main__':
101 main()
102 =======
103 app = MyApp(0) # Create an instance of the application class
104 app.MainLoop() # Tell it to start processing events
105 >>>>>>> 1.4
106
107 print 'done!'
108
109
110 #----------------------------------------------------------------------------
111 #
112 # $Log$
113 # Revision 1.6 1999/06/28 21:39:48 VZ
114 # 1. wxStaticLine implemented (generic (ugly) and MSW versions)
115 # 2. wxTextDialog looks fine under MSW again
116 # 3. startup tips added: code, sample, docs
117 # 4. read-only text controls don't participate in TAB traversal
118 #
119 # Revision 1.3 1998/12/15 20:44:34 RD
120 # Changed the import semantics from "from wxPython import *" to "from
121 # wxPython.wx import *" This is for people who are worried about
122 # namespace pollution, they can use "from wxPython import wx" and then
123 # prefix all the wxPython identifiers with "wx."
124 #
125 # Added wxTaskbarIcon for wxMSW.
126 #
127 # Made the events work for wxGrid.
128 #
129 # Added wxConfig.
130 #
131 # Added wxMiniFrame for wxGTK, (untested.)
132 #
133 # Changed many of the args and return values that were pointers to gdi
134 # objects to references to reflect changes in the wxWindows API.
135 #
136 <<<<<<< test1.py
137 # Other assorted fixes and additions.
138 #
139 # Revision 1.2 1998/10/02 06:42:27 RD
140 #
141 # Version 0.4 of wxPython for MSW.
142 #
143 # Revision 1.1 1998/08/09 08:28:05 RD
144 # Initial version
145 #
146 #
147 =======
148
149 >>>>>>> 1.4