Python_PyQt5_eric6 做省市县筛选框

时间:2022-02-14 04:12:48

eric是PyQt5的图形化编辑工具,界面如下(另存为-桌面  查看大图)

Python_PyQt5_eric6 做省市县筛选框

 

下面是用eric6制作的 省市县 三级联动筛选框 (效果图+源码)

Python_PyQt5_eric6 做省市县筛选框

Python_PyQt5_eric6 做省市县筛选框Python_PyQt5_eric6 做省市县筛选框
 1 # -*- coding: utf-8 -*-
2
3 # Form implementation generated from reading ui file 'E:\python35\eric6-17.10\A_Project\省市县\shengshixian.ui'
4 #
5 # Created by: PyQt5 UI code generator 5.9.2
6 #
7 # WARNING! All changes made in this file will be lost!
8
9 from PyQt5 import QtCore, QtGui, QtWidgets
10
11 class Ui_Dialog(object):
12 def setupUi(self, Dialog):
13 Dialog.setObjectName("Dialog")
14 Dialog.resize(1118, 871)
15 Dialog.setSizeGripEnabled(True)
16 self.groupBox = QtWidgets.QGroupBox(Dialog)
17 self.groupBox.setGeometry(QtCore.QRect(40, 20, 601, 171))
18 self.groupBox.setObjectName("groupBox")
19 self.label_4 = QtWidgets.QLabel(self.groupBox)
20 self.label_4.setGeometry(QtCore.QRect(60, 140, 51, 16))
21 self.label_4.setObjectName("label_4")
22 self.layoutWidget = QtWidgets.QWidget(self.groupBox)
23 self.layoutWidget.setGeometry(QtCore.QRect(80, 50, 358, 23))
24 self.layoutWidget.setObjectName("layoutWidget")
25 self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
26 self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
27 self.horizontalLayout.setObjectName("horizontalLayout")
28 self.label = QtWidgets.QLabel(self.layoutWidget)
29 self.label.setObjectName("label")
30 self.horizontalLayout.addWidget(self.label)
31 self.comboBox_sheng = QtWidgets.QComboBox(self.layoutWidget)
32 self.comboBox_sheng.setObjectName("comboBox_sheng")
33 self.horizontalLayout.addWidget(self.comboBox_sheng)
34 self.label_2 = QtWidgets.QLabel(self.layoutWidget)
35 self.label_2.setObjectName("label_2")
36 self.horizontalLayout.addWidget(self.label_2)
37 self.comboBox_shi = QtWidgets.QComboBox(self.layoutWidget)
38 self.comboBox_shi.setObjectName("comboBox_shi")
39 self.horizontalLayout.addWidget(self.comboBox_shi)
40 self.label_3 = QtWidgets.QLabel(self.layoutWidget)
41 self.label_3.setObjectName("label_3")
42 self.horizontalLayout.addWidget(self.label_3)
43 self.comboBox_quxian = QtWidgets.QComboBox(self.layoutWidget)
44 self.comboBox_quxian.setObjectName("comboBox_quxian")
45 self.horizontalLayout.addWidget(self.comboBox_quxian)
46 self.layoutWidget1 = QtWidgets.QWidget(self.groupBox)
47 self.layoutWidget1.setGeometry(QtCore.QRect(350, 130, 195, 30))
48 self.layoutWidget1.setObjectName("layoutWidget1")
49 self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget1)
50 self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
51 self.horizontalLayout_2.setObjectName("horizontalLayout_2")
52 self.pushButton_YES = QtWidgets.QPushButton(self.layoutWidget1)
53 self.pushButton_YES.setObjectName("pushButton_YES")
54 self.horizontalLayout_2.addWidget(self.pushButton_YES)
55 self.pushButton_2 = QtWidgets.QPushButton(self.layoutWidget1)
56 self.pushButton_2.setObjectName("pushButton_2")
57 self.horizontalLayout_2.addWidget(self.pushButton_2)
58 self.label_5 = QtWidgets.QLabel(self.groupBox)
59 self.label_5.setGeometry(QtCore.QRect(110, 140, 211, 21))
60 self.label_5.setText("")
61 self.label_5.setObjectName("label_5")
62
63 self.retranslateUi(Dialog)
64 self.pushButton_2.clicked.connect(Dialog.close)
65 QtCore.QMetaObject.connectSlotsByName(Dialog)
66
67 def retranslateUi(self, Dialog):
68 _translate = QtCore.QCoreApplication.translate
69 Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
70 self.groupBox.setTitle(_translate("Dialog", "省市县"))
71 self.label_4.setText(_translate("Dialog", "显示:"))
72 self.label.setText(_translate("Dialog", ""))
73 self.label_2.setText(_translate("Dialog", ""))
74 self.label_3.setText(_translate("Dialog", "区县"))
75 self.pushButton_YES.setText(_translate("Dialog", "YES"))
76 self.pushButton_2.setText(_translate("Dialog", "exit"))
77
78
79 if __name__ == "__main__":
80 import sys
81 app = QtWidgets.QApplication(sys.argv)
82 Dialog = QtWidgets.QDialog()
83 ui = Ui_Dialog()
84 ui.setupUi(Dialog)
85 Dialog.show()
86 sys.exit(app.exec_())
逻辑层 - 子程序
Python_PyQt5_eric6 做省市县筛选框Python_PyQt5_eric6 做省市县筛选框
 1 # -*- coding: utf-8 -*-
2
3 # Form implementation generated from reading ui file 'E:\python35\eric6-17.10\A_Project\省市县\shengshixian.ui'
4 #
5 # Created by: PyQt5 UI code generator 5.9.2
6 #
7 # WARNING! All changes made in this file will be lost!
8
9 from PyQt5 import QtCore, QtGui, QtWidgets
10
11 class Ui_Dialog(object):
12 def setupUi(self, Dialog):
13 Dialog.setObjectName("Dialog")
14 Dialog.resize(1118, 871)
15 Dialog.setSizeGripEnabled(True)
16 self.groupBox = QtWidgets.QGroupBox(Dialog)
17 self.groupBox.setGeometry(QtCore.QRect(40, 20, 601, 171))
18 self.groupBox.setObjectName("groupBox")
19 self.label_4 = QtWidgets.QLabel(self.groupBox)
20 self.label_4.setGeometry(QtCore.QRect(60, 140, 51, 16))
21 self.label_4.setObjectName("label_4")
22 self.layoutWidget = QtWidgets.QWidget(self.groupBox)
23 self.layoutWidget.setGeometry(QtCore.QRect(80, 50, 358, 23))
24 self.layoutWidget.setObjectName("layoutWidget")
25 self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
26 self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
27 self.horizontalLayout.setObjectName("horizontalLayout")
28 self.label = QtWidgets.QLabel(self.layoutWidget)
29 self.label.setObjectName("label")
30 self.horizontalLayout.addWidget(self.label)
31 self.comboBox_sheng = QtWidgets.QComboBox(self.layoutWidget)
32 self.comboBox_sheng.setObjectName("comboBox_sheng")
33 self.horizontalLayout.addWidget(self.comboBox_sheng)
34 self.label_2 = QtWidgets.QLabel(self.layoutWidget)
35 self.label_2.setObjectName("label_2")
36 self.horizontalLayout.addWidget(self.label_2)
37 self.comboBox_shi = QtWidgets.QComboBox(self.layoutWidget)
38 self.comboBox_shi.setObjectName("comboBox_shi")
39 self.horizontalLayout.addWidget(self.comboBox_shi)
40 self.label_3 = QtWidgets.QLabel(self.layoutWidget)
41 self.label_3.setObjectName("label_3")
42 self.horizontalLayout.addWidget(self.label_3)
43 self.comboBox_quxian = QtWidgets.QComboBox(self.layoutWidget)
44 self.comboBox_quxian.setObjectName("comboBox_quxian")
45 self.horizontalLayout.addWidget(self.comboBox_quxian)
46 self.layoutWidget1 = QtWidgets.QWidget(self.groupBox)
47 self.layoutWidget1.setGeometry(QtCore.QRect(350, 130, 195, 30))
48 self.layoutWidget1.setObjectName("layoutWidget1")
49 self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget1)
50 self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
51 self.horizontalLayout_2.setObjectName("horizontalLayout_2")
52 self.pushButton_YES = QtWidgets.QPushButton(self.layoutWidget1)
53 self.pushButton_YES.setObjectName("pushButton_YES")
54 self.horizontalLayout_2.addWidget(self.pushButton_YES)
55 self.pushButton_2 = QtWidgets.QPushButton(self.layoutWidget1)
56 self.pushButton_2.setObjectName("pushButton_2")
57 self.horizontalLayout_2.addWidget(self.pushButton_2)
58 self.label_5 = QtWidgets.QLabel(self.groupBox)
59 self.label_5.setGeometry(QtCore.QRect(110, 140, 211, 21))
60 self.label_5.setText("")
61 self.label_5.setObjectName("label_5")
62
63 self.retranslateUi(Dialog)
64 self.pushButton_2.clicked.connect(Dialog.close)
65 QtCore.QMetaObject.connectSlotsByName(Dialog)
66
67 def retranslateUi(self, Dialog):
68 _translate = QtCore.QCoreApplication.translate
69 Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
70 self.groupBox.setTitle(_translate("Dialog", "省市县"))
71 self.label_4.setText(_translate("Dialog", "显示:"))
72 self.label.setText(_translate("Dialog", ""))
73 self.label_2.setText(_translate("Dialog", ""))
74 self.label_3.setText(_translate("Dialog", "区县"))
75 self.pushButton_YES.setText(_translate("Dialog", "YES"))
76 self.pushButton_2.setText(_translate("Dialog", "exit"))
77
78
79 if __name__ == "__main__":
80 import sys
81 app = QtWidgets.QApplication(sys.argv)
82 Dialog = QtWidgets.QDialog()
83 ui = Ui_Dialog()
84 ui.setupUi(Dialog)
85 Dialog.show()
86 sys.exit(app.exec_())
UI - 父程序