1 .依赖安装
pip install-I https://mirrors.a liyun.com/pypi/simple/pyqt 5
pip install-I https://mirrors.a liyun.com/pypi/simple/pyqt5- tools
2,找到设计器绘图ui接口jqdsb
示例: windows
c :usersadministratorappdatalocalprogramspythonpython 37libsite-packagespyqt5_ tthon
事后保存haha.ui
3,vs代码转换. ui文件是. py文件(PYQT Integration扩展的安装) ) ) )。
然后,调用UI类运行py
importsysfrom nqdhh、QtGui、smdst、qmainwindowclassui _ mainwindow (object ) 3:defsetupui(self,main window ) 3360
self.central构件=Qt构件. q构件(主窗口) )。
self.central构件. set object name (' central构件' ) )。
self.push button=Qt widgets.qpushbutton (self.central构件) )。
自. push button.set geometry (Qt core.q rect (190,200,311,81 ) )
自. push button.set object name (push button ) )。
self.menubar=QtWidgets .诱人的果汁(MainWindow ) )。
self.menubar.set geometry (Qt core.q rect (0,0,800,23 ) )
self.menubar.set object name (' menubar ' ) )。
self.status bar=Qt widgets.qstatusbar (主窗口) ) ) ) ) ) )。
自. status bar.set object name (status bar ) )。
self.retranslateui (主窗口) )。
Qt core.qmetaobject.connectslotsbyname (主窗口) defretranslateui ) self,主窗口) :
_ translate=Qt core.qcoreapplication.translate
self.push button.settext (_ translate (main window ),'你好) ) if_name_=='__main_'3360
ui=ui _ main窗口()
ui.setup ui (主窗口) )。
sys.exit(app.exec_ ) )