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