0

I designed a UI in PyQt creator (Qt Designer section) and I converted it to a .py file using the "pyuic" method. but when I run it (for example on PyCharm IDE), nothing shows up and the process finishes without any result. (sorry for my bad English :) )

Do you think how can I fix it?

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets



class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1920, 1080)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(0, -20, 1920, 1080))
        self.label_2.setText("")
        self.label_2.setPixmap(QtGui.QPixmap("UI edited/Slide2EDITED.png"))
        self.label_2.setObjectName("label_2")
        self.label_id = QtWidgets.QLabel(self.centralwidget)
        self.label_id.setGeometry(QtCore.QRect(1528, 259, 191, 41))
        font = QtGui.QFont()
        font.setFamily("B Yekan")
        font.setBold(True)
        font.setWeight(75)
        self.label_id.setFont(font)
        self.label_id.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_id.setObjectName("label_id")
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)




    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_id.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:14pt; font-weight:600; color:#ffffff;\">شماره پرسنلي</span></p></body></html>"))
Pouya
  • 33
  • 7
  • use `-x` options – eyllanesc Oct 15 '21 at 16:15
  • @Pouya Those files are not intended to be directly run, but imported and used in the main script(s) as explained in the official guidelines about [using Designer](https://www.riverbankcomputing.com/static/Docs/PyQt5/designer.html). The `-x` flag adds executable code at the end of the normally generated file, but it's intended only for *testing* purposes. Also remember that those files should never, ***ever*** be manually modified. – musicamante Oct 15 '21 at 16:34

0 Answers0