Solved PyQt, add a widget programmatically, outside the __init__ function
-
I am trying to add a QCheckBox programmatically in a form and I am having a problem. If I do it in the init function, it works well and the QCheckBox is showing. But if I add it in a button click event, it does not show. Is there something I am doing wrong?
def __init__(self, parent=None): super(Frm_Test, self).__init__(parent) self.setupUi(self) # THIS WORKS test = QCheckBox("Test", self) test.move(50, 50) def btn_importer_click(self): # THIS DOESN'T WORK test = QCheckBox("Test", self) test.move(150, 50)
-
@Choz I got the answer, I have to call QCheckBox.Show() and it works.
-
@Choz I got the answer, I have to call QCheckBox.Show() and it works.