发布网友 发布时间:2022-05-01 10:14
共2个回答
热心网友 时间:2022-05-11 01:32
1、首先安装PyDev插件或者使用eclipse的在线安装插件功能。2、去下载pyqt4的windows安装程序,.exe文件装好以后会在lib下出现pyqt4的库安装完毕后,在Eclipse的Window->Preference->PyDev->Interpreter-Python下的Libraries添加PyQt安装后在Python文件夹下的路径,如图然后在ForcedBuiltins选项卡中添加PyQt4中的模块,可以在IDLE中使用importPyQt4help(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好了之后是这个样子第一个事例程序'''Createdon2013-6-20@author:Administrator'''importsysfromPyQt4importQtGui,QtCoreclassMyWidget(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_())