Enable native MacOS Mojave Dark Theme PySide2/Pyth

2019-08-29 00:21发布

问题:

I would like to know to enable the native MacOS Mojave Dark Theme (and if could be multiplatform win/linux, the better) which is supposed to be available from QT 5.12 (which I guess, it should be available in PySide2).

By default, the apps are still the same way, I don't know what to do to enable it.

Thanks!!

P.S.: using python 2.7.10 (and the solution of pyinstaler works!!, but not running python directly)

回答1:

It's not clear how are you running your application. As a module

python -m application
or
python application.py

For me with python 3.7.3 installed with homebrew just works.

But if you are using pyinstaller in the spec file in the section app = BUNDLE add this

info_plist={
   'NSRequiresAquaSystemAppearance': 'No'
},

App bundles I create with this option work in Dark Mode or Light Mode the application changes the interface to use the appropriate one.