Skip to main content

🌴 EZ Qt

EZ Qt is a simple collection of helper functions for PySide/PyQt widgets.

Installation

pip install ez-qt

Setting themes for your app

You can use app_colors to style the colors of your app. The accent colors can be set as either a QColor, or you can use ez_qt.constants.AccentColors

Screenshot Screenshot

Constants

You can use the short notation k to use the constants in this package.

import ez_qt

my_background_color = ez_qt.k.BackgroundColors.dark_gray

Various Examples

import sys
from PySide6.QtWidgets import *
import ez_qt

class Form(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("EZ Qt")
        self.setMinimumWidth(400)
        self.setMinimumHeight(300)
        self.layout = QVBoxLayout()

        # make a combo box
        self.cb_items = QComboBox()

        # make a list to add to our combo box
        european = ["Stockholm", "Paris", "Rome"]
        ez_qt.combo_box.add_items(self.cb_items, european)

        # let's add some more, but without any duplicates
        entire_world = ["New York", "Tokyo", "Toronto", "Paris", "Brussels"]
        ez_qt.combo_box.add_items(self.cb_items, entire_world, duplicates_allowed=False)

        # let's add the continents as a string
        continents = "Europe, America, Africa, Oceania"
        ez_qt.combo_box.add_items(self.cb_items, continents, string_split_character=",")

        # let's set the combo box to "Toronto"
        ez_qt.combo_box.set_to_item(self.cb_items, "Toronto")

        # let's gather everything in the combo box as a list to use later
        all_geography = ez_qt.combo_box.get_all_items(self.cb_items)

        # adding a list widget
        self.lw_items = QListWidget()

        # Let's add the list we gathered earlier and add it to the list widget
        ez_qt.list_widget.add_items(self.lw_items, items=all_geography)

        # Now let's add a button that removes the selected item from the listwidget
        # It will then also update our combo box to reflect the same update
        self.btn_remove_selected = QPushButton("Remove selected item")
        self.btn_remove_selected.clicked.connect(self.remove_and_update)

        self.layout.addWidget(self.cb_items)
        # adding a horizontal line
        self.layout.addWidget(ez_qt.general.QHLine())
        self.layout.addWidget(self.lw_items)
        self.layout.addWidget(self.btn_remove_selected)

        self.setLayout(self.layout)

    def remove_and_update(self):
        # first remove the selected items
        ez_qt.list_widget.remove_items(self.lw_items, selected=True)

        # then get the remaining items as a list
        listwidget_items = ez_qt.list_widget.get_all_items(self.lw_items)

        # and update the combobox
        ez_qt.combo_box.add_items(self.cb_items, items=listwidget_items, clear=True)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    # set the colors for our app
    # ez_qt.app_colors.set_medium_theme(app, accent_color=ez_qt.k.AccentColors.medium_pink)
    ez_qt.app_colors.set_dark_theme(app, accent_color=ez_qt.k.AccentColors.medium_pink)
    form = Form()
    form.show()
    sys.exit(app.exec_())

Metadata

Release files for ez-qt 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ez-qt 2.0.0
File Size Uploaded
ez_qt-2.0.0.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ez-qt 2.0.0
File Interpreter ABI Platform
ez_qt-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / ez_qt-2.0.0.tar.gz

Download URL ez_qt-2.0.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
10a08c0e9318055dfad195cccdcced898326f5310f2c8a0fa5cf65bdd0a233b9
BLAKE2b-256 checksum
How to use checksums
93b5c86b9a2c900dd6b454ca71c854d9be926bbb7a5511eea38d626423e0df14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / ez_qt-2.0.0-py3-none-any.whl

Download URL ez_qt-2.0.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1c10e559ff5f6eb30246de9a99956ff4ec6965151d4d2718470c7c25c94c776
BLAKE2b-256 checksum
How to use checksums
3fbdcac6f0f9ac151d3b50b99823155981ea2c24f1c0c645f3e32e0e15798d82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.2

2 release files

1.1.0

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page