Pyqt5 Program Created With Qtdesigner Doesnt Show Any Window When Opened From Terminal
I was working with QT Designer with no issues but today i started a fresh ubuntu 18.04 install, but this time when i run the PyQt5 programs from terminal they doesnt show any windo
Solution 1:
To generate a code that can show a window using pyuic you must use the -x
option:
pyuic5 input.ui -o output.py -x
The previous command using the -x
adds the following code to the end of the file:
if__name__== "__main__":
importsysapp= QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
Post a Comment for "Pyqt5 Program Created With Qtdesigner Doesnt Show Any Window When Opened From Terminal"