How load images properly with Python (pyqt)?

前端 未结 1 1490
南笙
南笙 2020-12-20 06:51

I have this estructure on my application:

|-App
|
|-functions
|
|-ui
|--ui.py
|    
|images
|
|main.py

i have a functions folder with some

相关标签:
1条回答
  • 2020-12-20 07:09

    Use the Qt Designer Resource System to create a resource file for the images.

    Then use PyQt's pyrcc tool to convert the Qt resource file into a python module.

    NB: The python resource module should go in the same directory as your ui files. So if you created the resource file App/resources.qrc in Qt Designer, you should then convert it like this:

    pyrcc4 -o App/ui/resources_rc.py App/resources.qrc
    

    PS:

    The equivalent tool for PySide is pyside-rcc.

    0 讨论(0)
提交回复
热议问题