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_())

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM