@JonB Much appreciate.
I've solved the problem under your instruction. Here are the test results:
I've found that under the Win 10 you can't directly use .qrc file(s) every time it will feedback
Could not create pixmap from
But here is the point: this method work just fine under the win 8 or win7 with Python 3.6 or maybe below(I've only tested on the other two computers: one with win 8.1 and python 3.6.2 another is win 7 with python 3.5.0. My friend, if you found the issue happened in another version of Python or windows system please let me know)
I DO NOT KNOW WHY there be differences. But under the win 10 and python 3.9.6(my current development environment), this happens!
here's what I do:
By turning the .qrc file to .py and importing the file to my main code.
step 1:
Win + R turn on the CMD and locate the .qrc address.
cd PATH
step 2:
use the code below in CMD.
pyrcc5 filename.qrc -o filename.py
step 3:
add a line at the beginning in your main python code:
import filename
As for your mentioned method number 2. it works fine for all scenarios. Of course, we can use the img resources directly. BUT, if the project involved enormous forms, Imgs, icons, pictures. I do recommend you use the .ui directly by the loadUI() method.