我想在pyqt4中创建两个相关的下拉列表,这是我的语法,没有错误,但它不起作用。
liste1=["value1","value2"]
self.comboBox.setGeometry(QtCore.QRect(128, 30, 140, 22))
self.comboBox.setObjectName(_fromUtf8("comboBox"))
self.comboBox.addItems(liste1)
self.comboBox_2 = QtGui.QComboBox(self.groupBox_6)
self.comboBox_2.setGeometry(QtCore.QRect(180, 40, 69, 22))
self.comboBox_2.setObjectName(_fromUtf8("comboBox_2"))
if self.comboBox.currentText()=="value1":
liste_b=['1','2','3','4','5','6','7']
self.comboBox_2.addItems(liste_b)
if self.comboBox.currentText()=="value2":
liste_b=['1','2','3','4','5','6','7','8','9','10','11','12']
self.comboBox_2.addItems(liste_b)