所以基本上我想做的是通过Stylesheet(QSS)向组合框添加一个向下箭头,这样我可以使用PyInstaller将py.file与--onefile选项捆绑在一起:代码是这样,但似乎不起作用:
QComboBox::drop-down{
image: url(resource_path("icon_example.png"))
}
并且resource_path方法为:
def resource_path(self,relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)