Skip to main content

The most complete customizable stylesheet for Python and Qt applications

Project description

QRainbowStyle is a fully customizable stylesheet for Python and Qt applications.

This module provides a function to load pre-compiled stylesheets. To generate your own style based on custom color palette clone package from project homepage.

qrainbowstyle.windows module adds frameless windows and message boxes. From version v0.8 module supports native Windows calls. Features:

  • Borders snapping

  • Minimize, restore, close animations

  • Size grips on borders

  • Frame shadow

  • Aero shake

https://raw.githubusercontent.com/desty2k/QRainbowStyleSheet/master/images/frameless_window_v3.png

On Linux and Darwin qrainbowstyle will load class with its own implementation of these features. Due to a bug in Qt, window minimizing is not supported on MacOS.

First, start importing our module

import qrainbowstyle

Then you can get stylesheet provided by QRainbowStyle for various Qt wrappers as shown below

# PySide2
stylesheet = qrainbowstyle.load_stylesheet_pyside2(style='oceanic')
# PyQt5
stylesheet = qrainbowstyle.load_stylesheet_pyqt5(style='oceanic')

Alternatively, from environment variables provided by QtPy, Qt.Py

# QtPy
stylesheet =  qrainbowstyle.load_stylesheet(style='oceanic')
# Qt.Py
stylesheet = qrainbowstyle.load_stylesheet(style='oceanic', qt_api=Qt.__binding__)

Finally, set your QApplication with it

app.setStyleSheet(stylesheet)

To load frameless window in your app import both qrainbowstyle and qrainbowstyle.windows modules

import qrainbowstyle
import qrainbowstyle.windows

Initialize qt app and load choosen stylesheet. Next, create instances of frameless window and your master widget with content you want to show.

# Create app and load selected stylesheet
app = QtWidgets.QApplication(sys.argv)
app.setStyleSheet(qrainbowstyle.load_stylesheet(style="oceanic"))

# Package options
# qrainbowstyle.alignButtonsLeft()      # align titlebar buttons to left side
# qrainbowstyle.useDarwinButtons()      # use darwin style buttons
qrainbowstyle.setAppName("My new application")  # set global name for application
# qrainbowstyle.setAppIcon("icon.ico")    # set global app icon

# Create frameless mainwindow
win = qrainbowstyle.windows.FramelessWindow()

# Create content widget and pass reference to main window
widget = MasterWidget(win)

# Add widget to main window and show it
win.addContentWidget(widget)
win.show()

sys.exit(app.exec())

Enjoy!

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

qrainbowstyle-0.9.6.tar.gz (1.6 MB view hashes)

Uploaded Source

Built Distribution

qrainbowstyle-0.9.6-py3-none-any.whl (1.7 MB view hashes)

Uploaded 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