QT Designer setting interface, button and other background images in PYQT5

Super simple tutorial for beginners


first step

Make a .qrc file and write your file address in <file>***</file>.

<RCC>
  <qresource prefix="/">
    <file>icon/background.jpg</file>
    <file>icon/表情.png</file>
    <file>icon/实时视频.png</file>
  </qresource>
</RCC>

Step 2

Execute the following code. apprcc.py is the file you want to generate, and apprcc.qrc is the .qrc file you made.

 pyrcc5 -o apprcc.py  apprcc.qrc

 third step

Right-click the object you want to add a background to and click Change Style Sheet.

Select Open File Resource File and select the .qrc file you just created. Then you can see the picture you just added.

 Add the image and select OK.

 

 

Guess you like

Origin blog.csdn.net/qq_51511878/article/details/130094662