if __name__ == "__main__": import sys app = qtwidgets.qapplication(sys.argv) mainwindow = qtwidgets.qmainwindow() ui = ui_mainwindow() ui.setupui(mainwindow) mainwindow.show() sys.exit(app.exec_())
qt 任务:
- 使用可执行文件(.py/.ui)中的指定参数提供图形编辑器的输出
- 将核心代码与前端链接(输出到网络是由许多使用绘图/设计的库提供的)
<?xml version="1.0" encoding="utf-8"?> <ui version="4.0"> <class>mainwindow</class> <widget class="qmainwindow" name="mainwindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>1126</width> <height>694</height> </rect> </property> <property name="windowtitle"> <string>security analysis of the smart home system</string> </property> <property name="stylesheet"> <string notr="true"/> </property>
未链接到 sql 的数据库使用表格形式手动显示。所有字段标题及其内容均以 xml 格式列出,以及它们在系统中的特征。
def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "Security analysis of the Smart Home system")) self.label.setText(_translate("MainWindow", "Select Smart Home options")) self.label_2.setText(_translate("MainWindow", "Smart lighting solutions:")) self.label_3.setText(_translate("MainWindow", "Smart home appliances:")) self.label_4.setText(_translate("MainWindow", "Control modules:")) self.label_5.setText(_translate("MainWindow", "Smart CCTV Cameras:")) self.label_6.setText(_translate("MainWindow", "Smart Garage Door Openers:")) self.label_7.setText(_translate("MainWindow", "Smart Home Sensors:")) self.pushButton.setText(_translate("MainWindow", "Analyze"))
图形对象及其符号以突出显示的形式列出(可以在网络上)。