windows下wxPython開發環境安裝與配置方法_python

來源:互聯網
上載者:User

安裝檔案準備:

安裝檔案 下載地址
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 與 wxPython 運行環境安裝

分別安裝python-2.6.2.msi、wxPython2.8-win32-unicode-2.8.10.1-py26.exe
wxPython2.8-win32-docs-demos-2.8.10.1.exe 和py2exe-0.6.9.win32-py2.6.exe
python安裝路徑採用預設C:\Python26,安裝完畢後,將這個目錄添加到path環境變數中

Pydev開發環境安裝

如果未安裝jre,請到www.java.com下載安裝
解壓縮eclipse-SDK-3.3.2-win32.zip 至D:\eclipse-3.3.2
解壓縮org.python.pydev.feature-1.4.7.2843.zip 至D:\eclipse-3.3.2\pydev-1.4.7\eclipse
在D:\eclipse-3.3.2\eclipse 下建立一個檔案夾“links”並在檔案夾下建立檔案pydev-1.4.7.link
用記事本開啟pydev-1.4.7.link ,輸入:path=D:/eclipse-3.3.2/pydev-1.4.7
解壓後的目錄結構如下:

複製代碼 代碼如下:

D:\
    +eclipse-3.3.2
    |--+eclipse
    |   |--+configuration
    |   |--+features
    |   |--+links
    |   |--+plugins
    |   |--+readme
    |   |---eclipse.exe
    |
    |--+pydev-1.4.7
        |--+eclipse
            |--+features
            |--+plugins

運行並配置Pydev

雙擊D:\eclipse-3.3.2\eclipse\eclipse.exe運行eclipse,選擇一個workspace,待載入完畢後,
開啟菜單:Window >> Preferences…,在彈出的對話方塊中,進入Pydev >> Interpreter – Python,
點擊Auto Config會自動載入Python 運行環境配置

開發wxPython應用

建立一個Pydev Project:proj1,然後建立一個Pydev Module:app1.py,輸入代碼:

import wxif __name__ == '__main__':  app = wx.PySimpleApp()  frame = wx.Frame(parent=None)  frame.Show(True)app.MainLoop()

右擊app1.py,選擇debug as >> python run, 即可運行
 
把python指令碼轉化成exe
建立模組:convert2exe.py,輸入代碼:

from distutils.core import setupimport py2exesetup(windows=[{"script": "app1.py"}])

然後運行windows的dos 命令列,切換目錄到proj1/src目錄下,輸入命令:
python convert2exe.py py2exe
Python 會產生dist檔案夾,並把依賴dll 等資源拷貝到這個目錄,同時產生 app1.exe
雙擊app1.exe 即可運行

文檔與學習資料

Python 與 wxPython 均內建有API文檔,在開始菜單中可以找到
《簡明 Python 教程》http://www.woodpecker.org.cn:9081/doc/abyteofpython_cn/chinese/
《wxPython In Action》http://wiki.woodpecker.org.cn/moin/WxPythonInAction

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.