]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | wxPython README |
2 | --------------- | |
3 | ||
4 | Introduction | |
5 | ------------ | |
6 | The code in this subtree is a Python Extension Module that enables the | |
7 | use of wxWindows from the Python language. So what is Python? Go to | |
8 | http://www.python.org to learn more but in a nutshell, it's an | |
9 | extremly cool object oriented language. It's easier than Perl and | |
10 | nearly as powerful. It runs on more platforms than Java, and by some | |
11 | reports, is even faster than Java with a JIT compiler! | |
12 | ||
9c039d08 | 13 | So why would you want to use wxPython over just C++ and wxWindows? |
7bf85405 RD |
14 | Personally I prefer using Python for everything. I only use C++ when |
15 | I absolutly have to eek more performance out of an algorithm, and even | |
16 | then I ususally code it as an extension module and leave the majority | |
17 | of the program in Python. Another good thing to use wxPython for is | |
18 | quick prototyping of your wxWindows apps. With C++ you have to | |
19 | continuously go though the edit-compile-link-run cycle, which can be | |
20 | quite time comsuming. With Python it is only an edit-run cycle. You | |
21 | can easily build an application in a few hours with Python that would | |
22 | normally take a few days with C++. Converting a wxPython app to a | |
23 | C++/wxWindows app should be a straight forward task. | |
24 | ||
25 | This extension module attempts to mirror the class heiarchy of | |
26 | wxWindows as closely as possble. This means that there is a wxFrame | |
27 | class in wxPython that looks, smells, tastes and acts almost the same | |
28 | as the wxFrame class in the C++ version. Unfortunatly, I wasn't able | |
29 | to match things exactly because of differences in the languages, but | |
30 | the differences should be easy to absorb because they are natural to | |
31 | Python. For example, some methods that return mutliple values via | |
32 | argument pointers in C++ will return a tuple of values in Python. | |
33 | These differences have not been documented yet so if something isn't | |
34 | working the same as described in the wxWindows documents the best | |
607d79b8 RD |
35 | thing to do is to scan through the wxPython sources, especially the .i |
36 | files, as that is where the interfaces for wxPython are defined. | |
7bf85405 RD |
37 | |
38 | Currently this extension module is designed such that the entire | |
39 | application will be written in Python. I havn't tried it yet, but I | |
40 | am sure that attempting to embed wxPython in a C++ wxWindows | |
41 | application will cause problems. However there is a plan to support | |
42 | this in the future. | |
43 | ||
44 | ||
08127323 RD |
45 | What's new in 0.5.3 |
46 | ------------------- | |
47 | Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. | |
48 | ||
49 | Various cleanup, tweaks, minor additions, etc. to maintain | |
50 | compatibility with the current wxWindows. | |
51 | ||
52 | ||
53 | ||
b8b8dda7 RD |
54 | What's new in 0.5.0 |
55 | ------------------- | |
56 | Changed the import semantics from "from wxPython import *" to "from | |
57 | wxPython.wx import *" This is for people who are worried about | |
58 | namespace pollution, they can use "from wxPython import wx" and then | |
59 | prefix all the wxPython identifiers with "wx." | |
60 | ||
61 | Added wxTaskbarIcon for wxMSW. | |
62 | ||
63 | Made the events work for wxGrid. | |
64 | ||
65 | Added wxConfig. | |
66 | ||
08127323 | 67 | Added wxMiniFrame for wxGTK. |
b8b8dda7 RD |
68 | |
69 | Changed many of the args and return values that were pointers to gdi | |
70 | objects to references to reflect changes in the wxWindows API. | |
71 | ||
72 | Other assorted fixes and additions. | |
73 | ||
74 | ||
75 | ||
607d79b8 RD |
76 | |
77 | What's new in 0.4.2 | |
78 | ------------------- | |
79 | ||
80 | wxPython on wxGTK works!!! Both dynamic and static on Linux and | |
81 | static on Solaris have been tested. Many thanks go to Harm | |
82 | <H.v.d.Heijden@phys.tue.nl> for his astute detective work on tracking | |
83 | down a nasty DECREF bug. Okay so I have to confess that it was just a | |
84 | DSM (Dumb Stupid Mistake) on my part but it was nasty none the less | |
85 | because the behavior was so different on different platforms. | |
86 | ||
87 | ||
88 | The dynamicly loaded module on Solaris is still segfaulting, so it | |
89 | must have been a different issue all along... | |
90 | ||
91 | ||
92 | ||
9c039d08 RD |
93 | What's New in 0.4 |
94 | ----------------- | |
607d79b8 | 95 | |
9c039d08 RD |
96 | 1. Worked on wxGTK compatibility. It is partially working. On a |
97 | Solaris/Sparc box wxPython is working but only when it is statically | |
98 | linked with the Python interpreter. When built as a dyamically loaded | |
607d79b8 RD |
99 | extension module, things start acting weirdly and it soon seg-faults. |
100 | And on Linux both the statically linked and the dynamically linked | |
101 | version segfault shortly after starting up. | |
9c039d08 RD |
102 | |
103 | 2. Added Toolbar, StatusBar and SplitterWindow classes. | |
104 | ||
105 | 3. Varioius bug fixes, enhancements, etc. | |
106 | ||
107 | ||
7bf85405 RD |
108 | |
109 | Build Instructions | |
110 | ------------------ | |
111 | I used SWIG (http://www.swig.org) to create the source code for the | |
112 | extension module. This enabled me to only have to deal with a small | |
d279310d | 113 | amount of code and only have to bother with the exceptional issues. |
7bf85405 RD |
114 | SWIG takes care of the rest and generates all the repetative code for |
115 | me. You don't need SWIG to build the extension module as all the | |
607d79b8 RD |
116 | generated C++ code is included under the src directory. |
117 | ||
118 | I added a few minor features to SWIG to control some of the code | |
119 | generation. If you want to playaround with this the patches are in | |
120 | wxPython/SWIG.patches and they should be applied to the 1.1p5 version | |
121 | of SWIG. These new patches are documented at | |
122 | http://starship.skyport.net/crew/robind/python/#swig, and they should | |
123 | also end up in the 1.2 version of SWIG. | |
7bf85405 RD |
124 | |
125 | wxPython is organized as a Python package. This means that the | |
126 | directory containing the results of the build process should be a | |
127 | subdirectory of a directory on the PYTHONPATH. (And preferably should | |
607d79b8 | 128 | be named wxPython.) You can control where the build process will dump |
7bf85405 RD |
129 | wxPython by setting the TARGETDIR makefile variable. The default is |
130 | $(WXWIN)/utils/wxPython, where this README.txt is located. If you | |
131 | leave it here then you should add $(WXWIN)/utils to your PYTHONPATH. | |
132 | However, you may prefer to use something that is already on your | |
133 | PYTHONPATH, such as the site-packages directory on Unix systems. | |
134 | ||
135 | ||
136 | Win32 | |
137 | ----- | |
138 | ||
9c039d08 RD |
139 | 1. Build wxWindows with wxUSE_RESOURCE_LOADING_IN_MSW set to 1 in |
140 | include/wx/msw/setup.h so icons can be loaded dynamically. While | |
141 | there, make sure wxUSE_OWNER_DRAWN is also set to 1. | |
7bf85405 RD |
142 | |
143 | 2. Change into the $(WXWIN)/utils/wxPython/src directory. | |
144 | ||
145 | 3. Edit makefile.nt and specify where your python installation is at. | |
146 | You may also want to fiddle with the TARGETDIR variable as described | |
147 | above. | |
148 | ||
149 | 4. Run nmake -f makefile.nt | |
150 | ||
151 | 5. If it builds successfully, congratulations! Move on to the next | |
152 | step. If not then you can try mailing me for help. Also, I will | |
d279310d | 153 | always have a pre-built win32 version of this extension module at |
7bf85405 RD |
154 | http://starship.skyport.net/crew/robind/python. |
155 | ||
156 | 6. Change to the $(WXWIN)/utils/wxPython/tests directory. | |
157 | ||
158 | 7. Try executing the test programs. Note that some of these print | |
159 | diagnositc or test info to standard output, so they will require the | |
160 | console version of python. For example: | |
161 | ||
162 | python test1.py | |
163 | ||
164 | To run them without requiring a console, you can use the pythonw.exe | |
165 | version of Python either from the command line or from a shortcut. | |
166 | ||
167 | ||
168 | ||
169 | Unix | |
170 | ---- | |
171 | ||
7bf85405 RD |
172 | 1. Change into the $(WXWIN)/utils/wxPython/src directory. |
173 | ||
174 | 2. Edit Setup.in and ensure that the flags, directories, and toolkit | |
607d79b8 RD |
175 | options are correct. See the above commentary about TARGETDIR. There |
176 | are a few sample Setup.in.[platform] files provided. | |
7bf85405 RD |
177 | |
178 | 3. Run this command to generate a makefile: | |
179 | ||
180 | make -f Makefile.pre.in boot | |
181 | ||
182 | 4. Run these commands to build and then install the wxPython extension | |
183 | module: | |
184 | ||
185 | make | |
186 | make install | |
187 | ||
188 | ||
189 | 5. Change to the $(WXWIN)/utils/wxPython/tests directory. | |
190 | ||
191 | 6. Try executing the test programs. For example: | |
192 | ||
193 | python test1.py | |
194 | ||
195 | ||
196 | ||
197 | ------------------------ | |
df9c33a4 | 198 | 10/20/1998 |
7bf85405 RD |
199 | |
200 | Robin Dunn | |
2d6dfbb7 | 201 | robin@alldunn.com |
607d79b8 RD |
202 | |
203 | ||
204 |