I converted a .ui
file of a project built on PyQtDesigner into a file .py
. In an external IDE, the code works and the dialog window shows, while on the Python console in Qgis doesn't work. Here is the code.
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(553, 419)
...
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
...
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())
I think the problem is the row if __name__ == "__main__":
but I don't know how to resolve this. Any Ideas?