PyCharm开发GUI之PyQt安装

开发环境

PyCharm 2018.3.3
python3.7

 

 

1 安装pyqt5

pip install PyQt5-tools

2 配置PyCharm

2.1 配置设计器

 

其中,program为C:\Users\edwin\AppData\Local\Programs\Python\Python37\Lib\site-packages\pyqt5_tools\designer.exe

arguments为$FileName$

working directory为$FileDir$

使用方法,新建 

 编缉

2.2 配置ui文件生成为py代码工具

其中,program定义为C:\Users\edwin\AppData\Local\Programs\Python\Python37\python.exe

arguments为-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py

working directory为$FileDir$

使用时

 

3 代码示例


from ui.main import Ui_Form
from PyQt5 import QtCore
from PyQt5 import QtWidgets



if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
w = QtWidgets.QMainWindow()
ex = Ui_Form()
ex.setupUi(w)
w.show()
sys.exit(app.exec_())

 

posted on 2019-01-31 16:07  Edwin.H  阅读(1258)  评论(0编辑  收藏  举报

导航