Skip to main content

A dark gray stylesheet for PyQt/PySide applications

Project description

QDarkGray Stylesheet

https://img.shields.io/travis/mstuttgart/qdarkgray-stylesheet/master.svg?style=flat-square https://img.shields.io/pypi/v/qdarkgraystyle.svg?style=flat-square https://img.shields.io/pypi/pyversions/qdarkgraystyle.svg?style=flat-square https://img.shields.io/pypi/l/qdarkgraystyle.svg?style=flat-square

A dark gray stylesheet for Qt applications (Qt4, Qt5, PySide, PyQt4 and PyQt5).

Installation

Python

Install qdarkgraystyle package using the setup script or using pip

python setup.py install

or

pip install qdarkgraystyle

C++

  1. Download/clone the project and copy the following files to your application directory (keep the existing directory hierarchy):

  • qdarkgraystyle/style.qss

  • qdarkgraystyle/style.qrc

  • qdarkgraystyle/rc/ (the whole directory)

  1. Add qdarkgraystyle/style.qrc to your .pro file

  2. Load the stylesheet

QFile f(":qdarkgraystyle/style.qss");
if (!f.exists())
{
    printf("Unable to set stylesheet, file not found\n");
}
else
{
    f.open(QFile::ReadOnly | QFile::Text);
    QTextStream ts(&f);
    qApp->setStyleSheet(ts.readAll());
}

Usage

Here is an example using PySide

import sys
import qdarkgraystyle
from PySide import QtGui


# create the application and the main window
app = QtGui.QApplication(sys.argv)
window = QtGui.QMainWindow()

# setup stylesheet
app.setStyleSheet(qdarkgraystyle.load_stylesheet())

# run
window.show()
app.exec_()

To use PyQt4 instead of PySide, you just need to replace

app.setStyleSheet(qdarkgraystyle.load_stylesheet())

by

app.setStyleSheet(qdarkgraystyle.load_stylesheet(pyside=False))

and

from PySide import QtGui

by

from PyQt4 import QtGui

To use PyQt5, you need to use load_stylesheet_pyqt5 instead of load_stylesheet.

app.setStyleSheet(qdarkgraystyle.load_stylesheet_pyqt5())

There is an example included in the example folder. You can run the script without installing qdarkgraystyle. You only need to have PySide (or PyQt4 or PyQt5) installed on your system.

Contribute

Snapshots

Here are a few snapshots:

Credits

This package is totally based on QDarkStyleSheet theme created by Colin Duquesnoy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qdarkgraystyle-0.0.2.tar.gz (92.2 kB view hashes)

Uploaded Source

Built Distribution

qdarkgraystyle-0.0.2-py2.py3-none-any.whl (79.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page