可能Cleanlooks 在您的系统上不再可用。通过QStyleFactory.keys(),您可以询问系统上可用的样式。在 Ubuntu 16.04 和 pyqt5 上,我只得到:
['Windows', 'GTK+', 'Fusion']
编辑:
here you find the qstyleplugin
内含6个附加样式,需自行编译
- 编辑:
在 ubuntu 16.04、python3.5 上,我通过将 styleplugins 安装到 QT5 并针对此 QT5 从源代码编译 pyqt5 来使其工作:
通过在线安装程序安装 QT 5.7
在安装目录中搜索qmake,在我的情况下为/opt/Qt/5.7/gcc_64/bin/qmake
下载qtstyleplugin到任意目录git clone https://code.qt.io/qt/qtstyleplugins.git并安装:
cd qtstyleplugins
/opt/Qt/5.7/gcc_64/bin/qmake # the qmake from the fresh installation
make
make install
现在/opt/Qt/5.7/gcc_64/plugins/ 中有一个文件夹“styles”,其中包含其他样式。
download sip-source,编译安装
download pyqt5-source,编译并安装它,在步骤python3 configure.py 通过--qmake-选项提供来自QT5-Installation 的qmake,并在输出中查找缺少的依赖项。
现在可以使用以下样式:
['bb10dark', 'bb10bright', 'cleanlooks', 'cde', 'motif', 'plastique', 'Windows', 'Fusion']
我得到一个 sip 错误:
RuntimeError: the sip module implements API v11.0 to v11.2 but the PyQt5.QtCore module requires API v11.3
为了防止它,在安装 sip as described here 之前运行 sudo apt-get purge python3-sip