http://www.cnblogs.com/fickleness/archive/2013/06/20/3145860.html
1、首先安装PyDev插件
http://www.pydev.org/download.html
或者使用eclipse的在线安装插件功能。
2、去下载pyqt4 的windows安装程序
http://www.riverbankcomputing.co.uk/software/pyqt/download/,.exe文件装好以后会在lib下出现pyqt4的库
安装完毕后,在Eclipse的Window->Preference->PyDev->Interpreter-Python 下的Libraries添加PyQt安装后在Python文件夹下的路径,如图
然后在Forced Builtins选项卡中添加PyQt4中的模块,可以在IDLE中使用import PyQt4 help(PyQt4)查看有哪些模块,分别添加进去,如图
复制这些字符,粘贴的时候有换行符,使用word的替换功能,把换行符^p替换成,,即可然后加入到
PyQt4.QAxContainer,PyQt4.Qsci,PyQt4.Qt,PyQt4.QtCore,PyQt4.QtDeclarative,PyQt4.QtDesigner,PyQt4.QtGui,PyQt4.QtHelp,PyQt4.QtMultimedia,PyQt4.QtNetwork,PyQt4.QtOpenGL,PyQt4.QtScript,PyQt4.QtScriptTools,PyQt4.QtSql,PyQt4.QtSvg,PyQt4.QtTest,PyQt4.QtWebKit,PyQt4.QtXml,PyQt4.QtXmlPatterns,PyQt4.phonon,PyQt4.pyqtconfig,PyQt4.uic
好了之后是这个样子
第一个事例程序
'''
Created on 2013-6-20
@author: Administrator
'''
import sys
from PyQt4 import QtGui,QtCore
class MyWidget(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setFixedSize(200, 120)
self.quit = QtGui.QPushButton("Quit", self)
self.quit.setGeometry(62, 40, 75, 30)
self.quit.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold))
self.connect(self.quit, QtCore.SIGNAL("clicked()"),
QtGui.qApp, QtCore.SLOT("quit()"))
app = QtGui.QApplication(sys.argv)
widget = MyWidget()
widget.show()
sys.exit(app.exec_())
下面是源自
http://www.keakon.net/2009/07/02/%E7%94%A8PyQt4%E6%89%93%E9%80%A0%E4%B8%80%E4%B8%AA%E7%AE%80%E6%98%93%E6%B5%8F%E8%A7%88%E5%99%A8
的一个几十行的浏览器程序。发现python真的很强大。。。。
运行结果
准备好好学学python了。。