Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Load Data From JSON PYQT5

# 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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Load #Data #From #JSON
ADD COMMENT
Topic
Name
7+1 =