Home>

I am contacting here with the same problem as a couple of months ago. Images are not displayed again inQLabel... I did everything according to the instructions that they wrote to me, but still an error comes out:

Could not create pixmap from: \ page1 \ 4a1.jpeg

Could not create pixmap from: \ page1 \ 4a1.jpeg

Could not create pixmap from: \ page1 \ 4a1.jpeg

Moreover, this problem began recently, a couple of weeks ago. Before that, everything worked fine. I am attaching the main codeIdioms.pyand.qrccode.

Idioms.py :

# -* -coding: utf-8 -* -
# Form implementation generated from reading ui file 'Idioms.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow (object):
    def setupUi (self, MainWindow):
        MainWindow.setObjectName ("MainWindow")
        MainWindow.resize (1100, 650)
        self.centralwidget= QtWidgets.QWidget (MainWindow)
        self.centralwidget.setObjectName ("centralwidget")
        self.verticalLayoutWidget= QtWidgets.QWidget (self.centralwidget)
        self.verticalLayoutWidget.setGeometry (QtCore.QRect (9, 0, 1081, 51))
        self.verticalLayoutWidget.setObjectName ("verticalLayoutWidget")
        self.verticalLayout= QtWidgets.QVBoxLayout (self.verticalLayoutWidget)
        self.verticalLayout.setContentsMargins (0, 0, 0, 0)
        self.verticalLayout.setObjectName ("verticalLayout")
        self.label= QtWidgets.QLabel (self.verticalLayoutWidget)
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (12)
        self.label.setFont (font)
        self.label.setAlignment (QtCore.Qt.AlignCenter)
        self.label.setObjectName ("label")
        self.verticalLayout.addWidget (self.label)
        self.label_2= QtWidgets.QLabel (self.verticalLayoutWidget)
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (12)
        self.label_2.setFont (font)
        self.label_2.setAlignment (QtCore.Qt.AlignCenter)
        self.label_2.setObjectName ("label_2")
        self.verticalLayout.addWidget (self.label_2)
        self.label_3= QtWidgets.QLabel (self.centralwidget)
        self.label_3.setGeometry (QtCore.QRect (30, 90, 621, 31))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (13)
        self.label_3.setFont (font)
        self.label_3.setAlignment (QtCore.Qt.AlignCenter)
        self.label_3.setObjectName ("label_3")
        self.label_4= QtWidgets.QLabel (self.centralwidget)
        self.label_4.setGeometry (QtCore.QRect (30, 140, 301, 81))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (11)
        self.label_4.setFont (font)
        self.label_4.setWordWrap (True)
        self.label_4.setObjectName ("label_4")
        self.label_5= QtWidgets.QLabel (self.centralwidget)
        self.label_5.setGeometry (QtCore.QRect (30, 230, 301, 81))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (11)
        self.label_5.setFont (font)
        self.label_5.setWordWrap (True)
        self.label_5.setObjectName ("label_5")
        self.label_6= QtWidgets.QLabel (self.centralwidget)
        self.label_6.setGeometry (QtCore.QRect (30, 320, 301, 81))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (11)
        self.label_6.setFont (font)
        self.label_6.setWordWrap (True)
        self.label_6.setObjectName ("label_6")
        self.label_7= QtWidgets.QLabel (self.centralwidget)
        self.label_7.setGeometry (QtCore.QRect (30, 410, 301, 81))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (11)
        self.label_7.setFont (font)
        self.label_7.setWordWrap (True)
        self.label_7.setObjectName ("label_7")self.label_8= QtWidgets.QLabel (self.centralwidget) self.label_8.setGeometry (QtCore.QRect (350, 140, 301, 101))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (11)
        self.label_8.setFont (font)
        self.label_8.setWordWrap (True)
        self.label_8.setObjectName ("label_8")
        self.label_9= QtWidgets.QLabel (self.centralwidget)
        self.label_9.setGeometry (QtCore.QRect (350, 260, 301, 81))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (11)
        self.label_9.setFont (font)
        self.label_9.setWordWrap (True)
        self.label_9.setObjectName ("label_9")
        self.label_10= QtWidgets.QLabel (self.centralwidget)
        self.label_10.setGeometry (QtCore.QRect (350, 360, 301, 111))
        font= QtGui.QFont ()
        font.setFamily ("Arial")
        font.setPointSize (11)
        self.label_10.setFont (font)
        self.label_10.setWordWrap (True)
        self.label_10.setObjectName ("label_10")
        self.horizontalLayoutWidget= QtWidgets.QWidget (self.centralwidget)
        self.horizontalLayoutWidget.setGeometry (QtCore.QRect (10, 570, 1081, 31))
        self.horizontalLayoutWidget.setObjectName ("horizontalLayoutWidget")
        self.horizontalLayout= QtWidgets.QHBoxLayout (self.horizontalLayoutWidget)
        self.horizontalLayout.setContentsMargins (0, 0, 0, 0)
        self.horizontalLayout.setObjectName ("horizontalLayout")
        self.pushButton_3= QtWidgets.QPushButton (self.horizontalLayoutWidget)
        self.pushButton_3.setObjectName ("pushButton_3")
        self.horizontalLayout.addWidget (self.pushButton_3)
        self.pushButton_2= QtWidgets.QPushButton (self.horizontalLayoutWidget)
        self.pushButton_2.setObjectName ("pushButton_2")
        self.horizontalLayout.addWidget (self.pushButton_2)
        self.pushButton= QtWidgets.QPushButton (self.horizontalLayoutWidget)
        self.pushButton.setObjectName ("pushButton")
        self.horizontalLayout.addWidget (self.pushButton)
        self.label_12= QtWidgets.QLabel (self.centralwidget)
        self.label_12.setGeometry (QtCore.QRect (670, 140, 411, 341))
        self.label_12.setStyleSheet ("background-image: url (: /page1 /4a1.jpeg);")
        self.label_12.setText ("")
        self.label_12.setPixmap (QtGui.QPixmap (": /page1 /4a1.jpeg"))
        self.label_12.setScaledContents (True)
        self.label_12.setObjectName ("label_12")
        MainWindow.setCentralWidget (self.centralwidget)
        self.menubar= QtWidgets.QMenuBar (MainWindow)
        self.menubar.setGeometry (QtCore.QRect (0, 0, 1100, 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.label.setText (_translate ("MainWindow", "Unit 4a"))
        self.label_2.setText (_translate ("MainWindow", "Come rain or shine!"))
        self.label_3.setText (_translate ("MainWindow", "Idioms1"))
        self.label_4.setText (_translate ("MainWindow", "<
html >
<
head />
<
body >
<
p >
<
span style= \ "text-decoration: underline; color: # 55007f; \" >
Under the weather <
/span >
<
span style= \ "text-decoration: underline; \" >
 -slightly unwell <
/span >
<
/p >
<
p >
<
span style= \ "font-style: italic; \" >
Example: Yumi is feeling under the weather, so she won \ 't be going to work today. <
/span >
<
/p >
<
/body >
<
/html >
"))
        self.label_5.setText (_translate ("MainWindow", "<
html >
<
head />
<
body >
<
p >
<
span style= \ "text-decoration: underline; color: # 55007f; \" >
On cloud nine <
/span >
<
span style= \ "text-decoration: underline; \" >-extremely happy < /span >
<
/p >
<
p >
<
span style= \ "font-style: italic; \" >
Example: Mo is on cloud nine -his wife is pregnant <
/span >
<
/p >
<
/body >
<
/html >
"))
        self.label_6.setText (_translate ("MainWindow", "<
html >
<
head />
<
body >
<
p >
<
span style= \ "text-decoration: underline; color: # 55007f; \" >
A breeze <
/span >
<
span style= \ "text-decoration: underline; \" >
 -very easy <
/span >
<
/p >
<
p >
<
span style= \ "font-style: italic; \" >
Example: Studying English is a breeze. I \ 'm progressin so quickly <
/span >
<
/p >
<
/body >
<
/html >
"))
        self.label_7.setText (_translate ("MainWindow", "<
html >
<
head />
<
body >
<
p >
<
span style= \ "text-decoration: underline; color: # 55007f; \" >
Rain cats and dogs <
/span >
<
span style= \ "text-decoration: underline; \" >
 -rain very hard <
/span >
<
/p >
<
p >
<
span style= \ "font-style: italic; \" >
Example: I was going to go shopping, but it suddenly started raining cats and dogs, so I stayed home <
/span >
<
/p >
<
/body >
<
/html >
"))
        self.label_8.setText (_translate ("MainWindow", "<
html >
<
head />
<
body >
<
p >
<
span style= \ "text-decoration: underline; color: # 55007f; \" >
Save up for a rainy day <
/span >
<
span style= \ "text-decoration: underline; \" >
 -put some money aside for whenever it may be needed <
/span >
<
/p >
<
p >
<
span style= \ "font-style: italic; \" >
Example: Once you have the basic home comforts, it \ 's importnat to save up for a rainy day <
/span >
<
/p >
<
/body >
<
/html >
"))
        self.label_9.setText (_translate ("MainWindow", "<
html >
<
head />
<
body >
<
p >
<
span style= \ "text-decoration: underline; color: # 55007f; \" >
Storm in a teacup <
/span >
<
span style= \ "text-decoration: underline; \" >
 -small problem that has been blown out of proportion <
/span >
<
/p >
<
p >
<
span style= \ "font-style: italic; \" >
Example: In my opininon, the whole thing is just a storm in a teacup <
/span >
<
/p >
<
/body >
<
/html >
"))
        self.label_10.setText (_translate ("MainWindow", "<
html >
<
head />
<
body >
<
p >
<
span style= \ "text-decoration: underline; color: # 55007f; \" >
Head in the clouds <
/span >
<
span style= \ "text-decoration: underline; \" >
 -not being realistic or daydreaming <
/span >
<
/p >
<
p >
<
span style= \ "font-style: italic; \" >
Example: He can \ 't continue going around with his head in the clouds; he must be more realistic about his problems <
/span >
<
/p >
<
/body >
<
/html >
"))
        self.pushButton_3.setText (_translate ("MainWindow", "Go to previous page"))
        self.pushButton_2.setText (_translate ("MainWindow", "Go to unit contents"))
        self.pushButton.setText (_translate ("MainWindow", "Go to next page"))
import Ids_rc
if __name__== "__main__":
    import sys
    app= QtWidgets.QApplication (sys.argv)
    MainWindow= QtWidgets.QMainWindow ()
    ui= Ui_MainWindow ()
    ui.setupUi (MainWindow)
    MainWindow.show ()
    sys.exit (app.exec_ ())

Ids.qrc :

<
RCC >
  <
qresource prefix= "page1" >
    <
file >
4a1.jpeg <
/file >
  <
/qresource >
<
/RCC >

As I said, I have already dealt with such a problem and do everything exactly as described in that article that dIm0n mentioned, but an error still appears.

Mswork62021-10-13 23:35:36