vscode 配置qtdesigner和pyuic
1、安装python扩展插件:

2、打开扩展设置:

3、配置Pyuic:Cmd与Qtdesigner:Path路径
1为pyuic的位置,这里先自己试一下默认的情况下ui能不能编译成python代码,能就不用改,不能就更改为pyuic.exe位置。
2为pyuic编译为.py文件的存放路径,如下为存放到当前ui文件所在目录,一般不做修改。
3为qtdesigner.exe的位置,添加好后就可以在vscode中打开qtdesigner设计ui界面了。
4、使用
右键ui文件,1为打开qtdesigner编辑界面。2为将ui文件编译为.py代码文件。
5、pyqt5简单框架举例
import Ui_untitled
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication
class my_mainwindow(object):
def __init__(self):
app = QApplication(sys.argv)
#########################
self.myMainWindow =QMainWindow()
self.myui = Ui_untitled.Ui_MainWindow()
self.myui.setupUi(self.myMainWindow)
#********************************************************************************
#按键绑定打开
self.click_pushbutton()
#********************************************************************************
self.myMainWindow.show()
#####################
sys.exit(app.exec_())
def click_pushbutton(self):
self.myui.pushButton.clicked.connect(self.print1)
self.myui.pushButton_2.clicked.connect(self.print2)
def print1(self):
print("print1 done")
def print2(self):
print("print2 done")
if __name__=="__main__":
my_mainwindow()

浙公网安备 33010602011771号