Pyqt window style can be configured.

The default style of PyQt is called ‘Fusion’. But this isn’t the only style, there are many styles or themes like ‘QtCurve’, ‘Windows’ and others.

You may want to distribute your app on multiple operating systems, and have a native look and feel. To do that, you change the theme.

If you are on Windows, you want the Windows look. On Mac you want the Mac OS X style. All of these can be configured. The Mac style is only available on Mac OS X.

Related Course: Create GUI Apps with Python PyQt5

PyQt style

Available styles

The available PyQt styles may differ system to system, but because many people install the PyQt binary the styles installed are often the same. You can get a list of available styles using the Python interpreter, like so:

$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.QtWidgets
>>> print(PyQt5.QtWidgets.QStyleFactory.keys())
['Breeze', 'Oxygen', 'QtCurve', 'Windows', 'Fusion']

The Breeze style looks like this:

pyqt breeze style

Configure style

After creating the application with QApplication([]), you can can set the Qt style with the function setStyle(style). For example if you want to set the style to Fusion, you add the line app.setStyle('Fusion').

In the example below we set the Windows style like so:

app = QApplication([])

Then the window shows like this (the old Win 9x style):

pyqt windows style

If you are new to Python PyQt, then I highly recommend this book.

Download Examples