Friday, 22 January 2021

PyQt application rcc converted image not found in raspbian (Raspberry Pi OS)

I'm developing a cross-platform application that runs both on Windows and Linux(in my case is Raspbian). I have converted all images in single file using C:\Python37\Scripts\pyside2-rcc.exe tests.qrc -o tests_rc.py. my tests.qrc file structure is something like this:

<RCC>
  <qresource prefix="images">
    <file>images/Slider_1m.png</file>
    <file>images/Slider_2m.png</file>
    <file>images/Slider_3m.png</file>
  </qresource>
</RCC>

after converting to tests_rc.py coded like this in the main script:

self.SLIDER.setText(QCoreApplication.translate("SLIDER",u"<html><head/><body><p align=\"center\"><img src=':/images/images/Slider_1m.png'/></p></body></html>", None))

that perfectly loaded in windows app no need to original image files anymore. But in raspbian, this kind of image wont load and I have to define location like this:

self.SLIDER.setText(QCoreApplication.translate("SLIDER",u"<html><head/><body><p align=\"center\"><img src='/home/pi/Myproject/ui/images/Slider_1m.png'/></p></body></html>", None))

As you see I set the exact image location. This is the way I have found to view in raspbian app and my tests_rc.py file is totally useless. What should be do to use tests_rc.py file in raspbian as same as windows?



from PyQt application rcc converted image not found in raspbian (Raspberry Pi OS)

No comments:

Post a Comment