Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

qt_widgetstyler is a small Python class intended to make the dynamic styling of Qt widgets via either PySide or PyQt a simpler task.

Project Description

Inherit WidgetStyler class:

from qt_widgetstyler import WidgetStyler
ws = WidgetStyler()

Create a new category. A category is a logical separation between different sections of your program’s widgets, and allows you to easily apply new or updated stylesheets to one or more categories simultaneously.


A custom widget group is created below the category. The custom widget group is a collection of individual widgets, generally of the same type (QLabel, QTableView, etc.), and all individual widget objects assigned to this custom widget group will share the same stylesheet.

ws.add_custom_widget(category='top_navigation', widget_name='top_navigation_qlabel_text')

For this category of our program, we have three QLabel widget objects which we wish to assign to our custom widget group, QLabel1, QLabel2, and QLabel3. We can add them individually, or together in a list.


ws.add_widget(widget_instance=QLabel1, category='top_navigation', widget_name='top_navigation_qlabel_text')


ws.add_widgets(widget_instances_list=[QLabel2, QLabel3], category='top_navigation', widget_name='top_navigation_qlabel_text')

We now add a StyleSheet to this custom widget group, which will be shared by all the widget objects assigned to it. This only stores the StyleSheet, it does not yet apply it:

ws.add_stylesheet(category='top_navigation', widget_name='top_navigation_qlabel_text', stylesheet='QLabel { color: rgb(0, 0, 0); }')

To apply the stylesheets to our widgets, we have three options.

We can apply one widget group’s stylesheets individually:

ws.apply_stylesheet(category='top_navigation', widget_name='top_navigation_qlabel_text')

To all widgets within one category:


Or to all of our widgets in all of our categories:


To view all of your defined categories:


To view all of your defined widgets within a single category:

Release History

Release History

This version
History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date (3.2 kB) Copy SHA256 Checksum SHA256 Source Nov 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting