我是python的新手,并且我正在使用simpy和Qt Designer。实际上,我是从Qt Designer进行设计的,然后将文件格式“ .ui”更改为“ .py”,但是每次将文件加载到pycharm中时,总是会收到错误“未命名模块” ,并且它不显示我在QT Designer中用于项目的任何图片。这是Qt设计器的图像
,然后将ui文件转换为py文件。源代码是
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(465, 466)
MainWindow.setAutoFillBackground(True)
MainWindow.setDockNestingEnabled(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.visualize = QtWidgets.QPushButton(self.centralwidget)
self.visualize.setGeometry(QtCore.QRect(356, 219, 75, 23))
self.visualize.setObjectName("visualize")
self.nCars = QtWidgets.QLineEdit(self.centralwidget)
self.nCars.setGeometry(QtCore.QRect(340, 170, 113, 20))
self.nCars.setObjectName("nCars")
self.parkingSpace = QtWidgets.QLineEdit(self.centralwidget)
self.parkingSpace.setGeometry(QtCore.QRect(340, 190, 113, 20))
self.parkingSpace.setObjectName("parkingSpace")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(60, 60, 301, 81))
font = QtGui.QFont()
font.setPointSize(26)
self.label.setFont(font)
self.label.setScaledContents(False)
self.label.setObjectName("label")
self.parkedArea = QtWidgets.QGraphicsView(self.centralwidget)
self.parkedArea.setGeometry(QtCore.QRect(40, 130, 211, 101))
self.parkedArea.setObjectName("parkedArea")
self.parkedCars = QtWidgets.QLCDNumber(self.centralwidget)
self.parkedCars.setGeometry(QtCore.QRect(273, 150, 51, 21))
self.parkedCars.setObjectName("parkedCars")
self.carExit = QtWidgets.QLabel(self.centralwidget)
self.carExit.setGeometry(QtCore.QRect(180, 250, 51, 71))
self.carExit.setText("")
self.carExit.setPixmap(QtGui.QPixmap(":/newPrefix/exitcar.jpg"))
self.carExit.setScaledContents(True)
self.carExit.setObjectName("carExit")
self.carEnter = QtWidgets.QLabel(self.centralwidget)
self.carEnter.setGeometry(QtCore.QRect(60, 250, 41, 71))
self.carEnter.setText("")
self.carEnter.setPixmap(QtGui.QPixmap(":/newPrefix/entercar.jpg"))
self.carEnter.setScaledContents(True)
self.carEnter.setObjectName("carEnter")
self.lEnter = QtWidgets.QLabel(self.centralwidget)
self.lEnter.setGeometry(QtCore.QRect(80, 330, 31, 16))
self.lEnter.setObjectName("lEnter")
self.lExit = QtWidgets.QLabel(self.centralwidget)
self.lExit.setGeometry(QtCore.QRect(200, 330, 21, 16))
self.lExit.setObjectName("lExit")
self.lEnterCars = QtWidgets.QLCDNumber(self.centralwidget)
self.lEnterCars.setGeometry(QtCore.QRect(50, 200, 51, 21))
self.lEnterCars.setObjectName("lEnterCars")
self.lParkedCars = QtWidgets.QLCDNumber(self.centralwidget)
self.lParkedCars.setGeometry(QtCore.QRect(110, 160, 51, 21))
self.lParkedCars.setObjectName("lParkedCars")
self.lLeaveCars = QtWidgets.QLCDNumber(self.centralwidget)
self.lLeaveCars.setGeometry(QtCore.QRect(180, 200, 51, 21))
self.lLeaveCars.setObjectName("lLeaveCars")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 465, 21))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.visualize.setText(_translate("MainWindow", "Visualize"))
self.nCars.setPlaceholderText(_translate("MainWindow", "Number Of Cars"))
self.parkingSpace.setPlaceholderText(_translate("MainWindow", "Parking Space"))
self.label.setText(_translate("MainWindow", "Parking Lot System"))
self.lEnter.setText(_translate("MainWindow", "Enter"))
self.lExit.setText(_translate("MainWindow", "Exit"))
错误出现在这里
import bc_rc
import qCar_rc
import test_rc
请告诉我有关如何解决此错误的解决方案。