Python uic.loadUi doesnt recongise button group

898 Views Asked by At

I have previously use the following steps to load PyQt ui into python.
1.Use designer to create the ui file
2.Go to dos and use pyuic4 to convert the ui files into python(MyQtUI.py)
3.Import in the python files

from MyQtUI import UI_Mainwindow

Class MyUi(QtGui.QMainWindow):
    def __init__(self,parent=none): 
        QtGui.Qwidget.__init__(self,parent)
        self = Ui_MainWindow()
        self.setupUi(self)
        self.ui.comboBox_Title.addItems("a","b","c")
        .
        .
        .
    def check_radioButtonStatus(self):
        print self.ui.radioBtnGrp_confirmed.checkedButton().objectName()

I have no problem running the above code but when i tried the other method which is using uic.loadUi, my button group could not be recognized.

Class MyUi(QtGui.QMainWindow):
    def __init__(self,parent=none): 
        QtGui.Qwidget.__init__(self,parent)
        uic.loadUi('MyQtUi.ui',self)
        self.comboBox_Title.addItems("a","b","c") <--- no problem here
        .
        .
        .
    def check_radioButtonStatus(self):
        print self.radioBtnGrp_confirmed.checkedButton().objectName() <--- object has no attribute 'radioBtnGrp_confirmed'

Thanks for any help

0

There are 0 best solutions below