安装QT
坑0:速度太慢超时,使用豆瓣国内镜像
坑1:dll缺失,安装visual studio2018
坑2: plugins 找不到:添加系统路径XXXX
QT_QPA_PLATFORM_PLUGIN_PATH
C:\Users\USER\AppData\Local\Programs\Python\Python35\Lib\site-packages\PyQt5\Qt\plugins
安装QT tools
designer.exe
pip install PyQt5-tools -i https://pypi.douban.com/simple
设置Pycharm
uic
C:\Users\USER\AppData\Local\Programs\Python\Python35\python.exe
-m PyQt5.uic.pyuic $FileName$ -o src/ui/$FileNameWithoutExtension$.py
$FileDir$
designer
C:\Users\USER\AppData\Local\Programs\Python\Python35\Lib\site-packages\qt5_applications\Qt\bin\designer.exe
$ProjectFileDir$
结合Qt写第一个UI窗口
from src.ui.untitled import Ui_MainWindow
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtCore import Qt
import sys
class MyWin(Ui_MainWindow):
def setupUi(self, MainWindow):
Ui_MainWindow.setupUi(self,MainWindow)
def setupConnection(self):
self.pushButton.clicked.connect(self