Installation File preparation:
Installation File |
|
Python-2.6.2.msi |
Http://www.python.org/download/ |
WxPython2.8-win32-unicode-2.8.10.1-py26.exe WxPython2.8-win32-docs-demos-2.8.10.1.exe |
Http://www.wxpython.org/download.php |
Py2exe-0.6.9.win32-py2.6.exe |
Http://sourceforge.net/projects/py2exe/files/ |
Eclipse-SDK-3.3.2-win32.zip |
Http://archive.eclipse.org/eclipse/downloads/index.php |
Org.python.pydev.feature-1.4.7.2843.zip |
Http://pydev.sourceforge.net/download.html |
Python and wxPython runtime environment Installation
Install python-2.6.2.msi1_wxpython2.8-win32-unicode-2.8.10.1-py26.exe separately
WxPython2.8-win32-docs-demos-2.8.10.1.exe and py2exe-0.6.9.win32-py2.6.exe
The python installation path uses the default C: \ Python26. After installation, add the directory to the path environment variable.
Install the Pydev Development Environment
If jre is not installed, go to www.java.com to download and install jre.
Decompress eclipse-sdk-3.3.2-win32.zip to D: \ eclipse-3.3.2
Uncompress org.python.pydev.feature-1.4.7.2843.zip to D: \ eclipse-3.3.2 \ pydev-1.4.7 \ eclipse
Create a folder "links" under D: \ eclipse-3.3.2 \ eclipse and create a file pydev-1.4.7.link under the folder
Open the pydev-1.4.7.link with notepad and enter: path = D:/eclipse-3.3.2/pydev-1.4.7
The decompressed directory structure is as follows:
Copy codeThe Code is as follows:
D :\
+ Eclipse-3.3.2
| -- + Eclipse
| -- + Configuration
| -- + Features
| -- + Links
| -- + Plugins
| -- + Readme
| ---Eclipse.exe
|
| -- + Pydev-1.4.7
| -- + Eclipse
| -- + Features
| -- + Plugins
Run and configure Pydev
Double-click D: \ eclipse-3.3.2 \ eclipse \ eclipse.exe to run eclipse and select a workspace. After loading,
Open the menu: Window> Preferences ..., In the displayed dialog box, go to Pydev> Interpreter-Python,
Click Auto Config to automatically load the Python runtime environment configuration.
Develop wxPython applications
Create a Pydev Project: proj1, create a Pydev Module: app1.py, and enter the code:
import wxif __name__ == '__main__': app = wx.PySimpleApp() frame = wx.Frame(parent=None) frame.Show(True)app.MainLoop()
Right-click app1.py and choose debug as> python run to run
Convert a python script to an exe
Create a module: convert2exe. py, and enter the code:
from distutils.core import setupimport py2exesetup(windows=[{"script": "app1.py"}])
Run the dos command line of windows, switch the directory to the proj1/src directory, and enter the command:
Python convert2exe. py py2exe
Python generates the dist folder, copies the dependent dll and other resources to this directory, and generates app1.exe
Double-click app1.exe to run
Documents and learning materials
Both Python and wxPython have their own API documentation, which can be found in the Start Menu.
Concise Python tutorial http://www.woodpecker.org.cn: 9081/doc/abyteofpython_cn/chinese/
WxPython In Action http://wiki.woodpecker.org.cn/moin/WxPythonInAction.