'Ui_MainWindow' object has no attribute
-
'Ui_MainWindow' object has no attribute 'lbl_Question_No_denary' is the error I keep getting I import UI code for a GUI made in QT Designer. The GUI has 3 tabs. the first tabs widgets are recognised, but the second is not?
the code is below:
class MainWindow_EXEC():def init(self):
app = QtWidgets.QApplication(sys.argv)MainWindow = QtWidgets.QMainWindow() self.ui = Ui_MainWindow() self.ui.setupUi(MainWindow) # Binary Game instantiation self.ui.lbl_DenarytoBinary_Question_No.setText(str(1)) self.ui.lbl_BinarytoDenary_currentScore.setText(str(0)) self.ui.progressBar_BinarytoDenary.setValue(0) self.ui.lbl_BinarytoDenary_result.setText("") self.ui.lbl_BinarytoDenary_result_2.setText("") self.ui.spinBox_BinarytoDenary.setValue(0) self.createRandomBinaryNumber() self.ui.btn_BinarytoDenary_Answer.clicked.connect(self.getAnswerBinary) # Denary Game instantiation
self.ui.lbl_Question_No_denary.setText(str(1))
self.ui.lbl_random_number_denary.setText(str(00))
self.ui.self.spinBox_16_denary.setValue(0)
self.ui.self.spinBox_8_denary.setValue(0)
self.ui.self.spinBox_4_denary.setValue(0)
self.ui.self.spinBox_2_denary.setValue(0)
self.ui.self.spinBox_1_denary.setValue(0)
self.progressBar_denary.setValue(0)self.createRandomDenaryNumber()
self.btn_Answer_denary.clicked.connect(self.getAnswerDenary)MainWindow.show()
sys.exit(app.exec_()) -
@Steve-Horton said in 'Ui_MainWindow' object has no attribute:
lbl_Question_No_denary
Is the name really correct?
-
yes, its. I have checked. It does not recognise any of the widgets from the second tab.
-
@Steve-Horton
Hi
How do you import it ?
as far as i understand one has to run pyuic5 on the ui file to generate ?