# saver.py
class Window(QMainWindow):
def __init__(self):
super().__init__()
central = QWidget()
self.setCentralWidget(central)
label = QLabel(central, text='myForm')
self.setWindowTitle('myTitle')
self.show()
formBuilder = QFormBuilder()
file = QFile('line_up.ui')
file.open(QFile.WriteOnly)
formBuilder.save(file, central)
file.close()
# loader.py
class MyForm(QMainWindow):
def __init__(self):
super().__init__()
formBuilder = QFormBuilder()
file = QFile('line_up.ui')
file.open(QFile.ReadOnly)
widget = formBuilder.load(file, self)
file.close()
self.setCentralWidget(widget)