eclipse開發python+qt

來源:互聯網
上載者:User

Qt的思路很好,最少的代碼,最大的功能。用起來確實方便。python嘛,用起來就一個字“爽”。於是能用指令碼語言開發介面,確實很高效。感覺比進階語言做介面還酷,雖然未必有那麼炫?微軟的WPF也非常好,但是太龐大。又不跨平台。

 

於是就用python寫qt吧。

 

語言及開發庫: qt4.7, python3.2, pyqt4

整合式開發環境: eclipse + pydev + vim

開發協助工具輔助: qt-elipse-integration/qdesigner + pyuic

代碼及專案管理:googlecode + hg

 

介面編譯:

用designer做好的介面,可以通過pyuic編譯成py檔案。

為了方便,我在eclipse裡添加了一個python指令碼的external tool:

import sys,os<br />if len(sys.argv) <=1:<br />print("no input .ui file found!")<br />sys.exit()<br />uifile = sys.argv[1]<br />outfile = uifile.replace(".","_")+".py"<br />cmdstr = "d:/python32/python.exe D:/Python32/Lib/site-packages/PyQt4/uic/pyuic.py "<br />os.system(cmdstr + uifile + " -o " + outfile)<br /> 

就是傳一個參數給pyuic讓它編譯出自己想要的py檔案,加到eclipse的external tools裡,用起來很方便。省的每次去CMD裡執行了。

 

另外pydev有個問題,它沒識別我的pyqt4名稱空間裡的東西,老報錯。雖然不影響執行,但看著不爽。

 

解決方案:

在eclipse的perferences裡pydev的code analysis頁面下:

將undefined頁簽下的undefined variable from import 行為改成ignore忽略即可。。

 

最後,附上幾個連結以備用:

1. Qt Eclipse Integration: http://qt.nokia.com/developer/eclipse-integration/

2. PyDev: http://pydev.org/nightly/

3. Eclipse Hg: http://www.vectrace.com/eclipse-update/

4. ViPlugin: http://www.viplugin.com/

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.