New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyQt app styles problem after packaging it with pyinstaller #3338

Devligue opened this Issue Feb 26, 2018 · 5 comments


None yet
4 participants

Devligue commented Feb 26, 2018

I am not 100% sure whether it is pyinstaller issue or a PyQt bug, but to find the answer I have to start somewhere.

Some questions connected with this problem have been asked on stackoverflow and are still waiting for any response:

In my case it is as follows. I use PyQt5 and PyInstaller 3.3.1 with Python 3.6.1 virtualenv on Windows 10. To begin with everything works fine as far as PyInstaller is not involved. If I do not set any style for PyQt app it correctly uses the QWidnowsVistaStyle which is afaik is the "native" modern windows style. Things change if I use PyInstaller to package the application, because packaged app suddenly uses the QWindowsStyle which is a "classic" old windows look. All this happens on one PC, so I imagine the default style should be the same regardless whether the app is run from the src code or packaged binary.

In fact the problem is not that it uses the wrong style. The problem is that in the packaged application QWindowsVistaStyle is not present at all. Calling QtWidgets.QStyleFactory.keys() from src code returns ['windowsvista', 'Windows', 'Fusion'] while the same line after packaging returns only ['Windows', 'Fusion']. I understand that the styles available are platform dependent, but how does PyInstaller influences this and makes QWindowsVistaStyle disappear?

To reproduce this please try following code before and after packaging:

import sys
from PyQt5 import QtWidgets

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    print('Currently used style:',
    print('Available styles:', QtWidgets.QStyleFactory.keys())

This comment has been minimized.


bjones1 commented Feb 26, 2018

Does #3233 fix this for you? It should do a better job of finding all the necessary plugins.


This comment has been minimized.

awolk commented Feb 27, 2018

I am the author of the first Stack Overflow question, I can confirm this fixed the problem for me.


This comment has been minimized.


bjones1 commented Feb 27, 2018

@awolk, thanks for testing. Glad it works! So, I'll go ahead and close this issue.

@bjones1 bjones1 closed this Feb 27, 2018


This comment has been minimized.

Devligue commented Feb 27, 2018

@bjones1 I also confirm that this solved my problem. The build process took more then twice the usual time, but everything comes with the price I suppose :)

Thank you for this fix.


This comment has been minimized.


bjones1 commented Feb 27, 2018

@Devligue, thanks also for the tests. Yes, I have it spit out a lot of diagnostic info and it does work harder to package everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment