A
A
Anastasia2020-11-04 16:11:11
Python
Anastasia, 2020-11-04 16:11:11

Why wasn't the graphical interface drawn in the terminal after launch?

Converted ui file to python code.
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QIcon
from my_dezainer import Ui_MainWindow

class CurrencyConv(QtWidgets.QMainWindow):
def __init__(self):
super(CurrencyConv, self).__init__()
self.ui = Ui_MainWindow( )
self.ui.setupUi(self)

app = QtWidgets.QApplication([])
application = CurrencyConv()
application.show()
sys.exit(app.exec())

But it loads empty window without design, in Visual st code editor Code
Although the file itself is converted to py format, it opens with a design through the console!
where is the error please help?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MasterCard000, 2020-11-04
@MasterCard000

Try like this

class CurrencyConv(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        QtWidgets.QMainWindow.__init__(self)
        self.setupUi(self)

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    application = CurrencyConv()
    application.show()
    sys.exit(app.exec_())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question