How to install and configure wxPython development environment in windows

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.