ui file to py pyqt5 code example
Example 1: how to convert ui to py pyqt5
# To convert .ui file to .py using pyqt5 module
>> pyuic5 -x main.ui -o main.py # pyQt5 version
>> pyuic4 -x main.ui -o main.py # pyQt4 version
Example 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