(1条消息) VS2017+PyQt5环境配置以及第一个HellowPyQt5_vs pyqt_2011老王的博客-CSDN博客
利用工具里的PyUIC5,将ui转为py
选中刚加入的ui文件,工具=》PyUIC5
利用工具里的PyUIC5,将ui转为py
选中刚加入的ui文件,工具=》PyUIC5
利用工具里的PyUIC5,将ui转为py
选中刚加入的ui文件,工具=》PyUIC5
将转换出来的py文件添加到项目
# -*- coding: utf-8 -*-
from main_form import Ui_MainWindow
# import PyQt5
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import QImage, QPixmap
class MyWindow(QMainWindow, Ui_MainWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setupUi(self)
self.pushButton.clicked.connect(self.OnPushButton1)
num = 0
def OnPushButton1(self):
self.textEdit.append("HellowPyQt5")
self.num += 1
self.setWindowTitle("pushbutton has been clicked {0} times".format(self.num))
return None
if __name__ == "__main__":
app = QApplication(sys.argv)
mainWindow = MyWindow()
mainWindow.show()
sys.exit(app.exec_())