Answers for "python pyqt5 directly ui load"

2

how to load ui file in pyqt5

class Ui(QtWidgets.QMainWindow):
    def __init__(self):
        super(Ui, self).__init__() # Call the inherited classes __init__ method
        uic.loadUi('basic.ui', self) # Load the .ui file
        self.show() # Show the GUI
Posted by: Guest on November-22-2020
3

Python PyQt5

# pip install PyQt5==5.15.2
from PyQt5.QtWidgets import QApplication,QMainWindow,QLabel
import sys
app=QApplication(sys.argv)
app.setStyle('Fusion')
app.setApplicationName('PyQt5 App')
win=QMainWindow()
label=QLabel()
label.setText('An App')
win.setCentralWidget(label)
win.show()
sys.exit(app.exec_())
Posted by: Guest on March-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language