How to properly set parent of a widget in Pyqt?
I have the following code from PyQt5 import QtCore, QtGui, QtWidgets from mw import Ui_MainWindow as mwin from wd import Ui_Form as wdg class widget(QtWidgets.QWidget): def __init__(self,parent = None): super(widget,self).__init__(parent) self.ui = wdg() self.ui.setupUi(self) self.show() class Main(QtWidgets.QMainWindow): def __init__(self,parent = None): super(Main,self).__init__(parent) self.ui = mwin() self.ui.setupUi(self) self.show() w = widget(self) import sys if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) mn = Main() sys.exit(app.exec_()) The Ui is generated by qt des
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.