S
S
Soldat22832020-06-28 16:00:33
Python
Soldat2283, 2020-06-28 16:00:33

PyQt5 plugin not initialized, what to do?

I'm trying to run the program it doesn't work what to do
Here is the error:

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Here is the code:

from PySide2 import QtCore, QtGui, QtWidgets
import sys
from Ui import Ui_Dialog

app = QtWidgets.QApplication(sys.argv)

Form = QtWidgets.QDialog()
ui = Ui_Dialog()
ui.setupUi(Form)
Form.show()

#Логика

sys.exit(app.exec_())


Here is the interface code:

from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(343, 349)
        Dialog.setStyleSheet("QPushButton{\n"
"    background-color:white;\n"
"    width:75px;\n"
"    height:50px;\n"
"    font-size:14px;\n"
"    font-weight:bold;\n"
"    border:none;\n"
"    text-aling:center;\n"
"}\n"
"\n"
"QPushButton:hover{\n"
"    background-color:silver;\n"
"}\n"
"\n"
"QPushButton:pressed{\n"
"    background-color:#4D4A49;\n"
"}\n"
"\n"
"QLabel{\n"
"    font-size:25px;\n"
"    font-weight:bold;\n"
"}\n"
"\n"
"pushButton_17{\n"
"    background-color:none;\n"
"\n"
"}")
        self.gridLayoutWidget = QtWidgets.QWidget(Dialog)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 70, 320, 251))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.pushButton_3 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_3.setObjectName("pushButton_3")
        self.gridLayout.addWidget(self.pushButton_3, 1, 1, 1, 1)
        self.pushButton_2 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_2.setObjectName("pushButton_2")
        self.gridLayout.addWidget(self.pushButton_2, 2, 1, 1, 1)
        self.pushButton_12 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_12.setObjectName("pushButton_12")
        self.gridLayout.addWidget(self.pushButton_12, 3, 0, 1, 1)
        self.pushButton_5 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_5.setObjectName("pushButton_5")
        self.gridLayout.addWidget(self.pushButton_5, 1, 0, 1, 1)
        self.pushButton_8 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_8.setObjectName("pushButton_8")
        self.gridLayout.addWidget(self.pushButton_8, 1, 2, 1, 1)
        self.pushButton_9 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_9.setObjectName("pushButton_9")
        self.gridLayout.addWidget(self.pushButton_9, 0, 2, 1, 1)
        self.pushButton_10 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_10.setObjectName("pushButton_10")
        self.gridLayout.addWidget(self.pushButton_10, 3, 1, 1, 1)
        self.pushButton = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton.setObjectName("pushButton")
        self.gridLayout.addWidget(self.pushButton, 0, 1, 1, 1)
        self.pushButton_11 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_11.setObjectName("pushButton_11")
        self.gridLayout.addWidget(self.pushButton_11, 3, 2, 1, 1)
        self.pushButton_4 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_4.setObjectName("pushButton_4")
        self.gridLayout.addWidget(self.pushButton_4, 0, 0, 1, 1)
        self.pushButton_6 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_6.setObjectName("pushButton_6")
        self.gridLayout.addWidget(self.pushButton_6, 2, 0, 1, 1)
        self.pushButton_7 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_7.setObjectName("pushButton_7")
        self.gridLayout.addWidget(self.pushButton_7, 2, 2, 1, 1)
        self.pushButton_13 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_13.setObjectName("pushButton_13")
        self.gridLayout.addWidget(self.pushButton_13, 0, 3, 1, 1)
        self.pushButton_14 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_14.setObjectName("pushButton_14")
        self.gridLayout.addWidget(self.pushButton_14, 1, 3, 1, 1)
        self.pushButton_15 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_15.setObjectName("pushButton_15")
        self.gridLayout.addWidget(self.pushButton_15, 2, 3, 1, 1)
        self.pushButton_16 = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton_16.setObjectName("pushButton_16")
        self.gridLayout.addWidget(self.pushButton_16, 3, 3, 1, 1)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 10, 321, 41))
        self.label.setText("")
        self.label.setObjectName("label")

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

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.pushButton_3.setText(_translate("Dialog", "5"))
        self.pushButton_2.setText(_translate("Dialog", "2"))
        self.pushButton_12.setText(_translate("Dialog", "←"))
        self.pushButton_5.setText(_translate("Dialog", "4"))
        self.pushButton_8.setText(_translate("Dialog", "6"))
        self.pushButton_9.setText(_translate("Dialog", "9"))
        self.pushButton_10.setText(_translate("Dialog", "0"))
        self.pushButton.setText(_translate("Dialog", "8"))
        self.pushButton_11.setText(_translate("Dialog", "="))
        self.pushButton_4.setText(_translate("Dialog", "7"))
        self.pushButton_6.setText(_translate("Dialog", "1"))
        self.pushButton_7.setText(_translate("Dialog", "3"))
        self.pushButton_13.setText(_translate("Dialog", "*"))
        self.pushButton_14.setText(_translate("Dialog", "/"))
        self.pushButton_15.setText(_translate("Dialog", "+"))
        self.pushButton_16.setText(_translate("Dialog", "-"))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim, 2020-06-28
@Viji

There is a solution here - opencv version
https://stackoverflow.com/questions/60042568/this-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question