I made a GUI file from pyqt designer,which i converted to .py file.but when i load that .py code in my IDE (Pycharm and sublime text),and i try to run it,it runs without errors,but the physical aspect of GUI isn't loaded,i tried a custom code from the internet,which worked great,GUI shows up when i run that code. i will give simpler code than the one i'm currently working on,as it seems all of the code generated from pyqt designer doesn't work at all for me regarding its physical aspect.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(400, 300)
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(170, 200, 91, 30))
self.pushButton.setObjectName("pushButton")
self.lineEdit = QtWidgets.QLineEdit(Form)
self.lineEdit.setGeometry(QtCore.QRect(30, 40, 113, 30))
self.lineEdit.setObjectName("lineEdit")
self.retranslateUi(Form)
self.pushButton.clicked.connect(self.lineEdit.clear)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.pushButton.setText(_translate("Form", "PushButton"))
You have 2 options:
1. Assuming you have used the following command:
That command does not generate a window object or call the show method so the window is not displayed, you must use option
-x
:2. Add the code that invokes an object: