Skip to main content

A Qt library extension for building declarative programming -style UIs completely within python.

Project description

Declarative PySide6

decpys (or Dec-larative PyS-ide) is a Python library that acts as a thin wrapper around the original PySide6 to enable super-fast GUI prototyping using modern declarative UI techniques completely within Python. decpys is licensed under GPLv2.

Installation

decpys is available through PyPI. From the command-line, simply:

pip install decpys

Design

decpys is inspired by UI frameworks like React and Flutter. decpys extends the popular PySide6 Qt library so that Qt widgets can be used in a intuitive, concise manner to build out declarative-style UI blocks completely within python.

Normally, Qt is used to build UIs in an imperative manner. This means that each widget and its properties must be set, step-by-step. This might look familiar to you:

window = QMainWindow()
widget = QWidget()
label = QLabel()
label.setText("a label")
layout = QVBoxLayout()
layout.addWidget(label)
widget.setLayout(layout)
window.setCentralWidget(widget)
window.setWindowTitle("a window")

It's cumbersome. Qt introduced QML a while back, but that introduces a new syntax and file format to learn. Tools also have to be made in IDEs/editors to give users the speed they seek developing.

Let's take a look at the last example, this time written using decpys:

window = qMainWindow(
    title="a window",
    centralWidget=qWidget(
        layout=qVBoxLayout(
            children=[
                qLabel(
                    text="a label"
                )
            ]
        )
    )
)

Indents lend themselves well to visualizing widget hierarchy. Python's keyword arguments (and many IDEs' support for type hinting) help the user find relevant properties. If you've ever used a declarative-UI framework, you know the benefits it brings to productivity and readable code.

See the ClickableButton example for a more involved look at how decpys can be used.

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

decpys-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

decpys-0.1.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file decpys-0.1.0.tar.gz.

File metadata

  • Download URL: decpys-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

File hashes

Hashes for decpys-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5786a570f05253d57c91e524a61e6f1c6c2cf2d034a3b1e6d64de837f7705e32
MD5 8cf78d58fb47aaefecba21d9c32154d9
BLAKE2b-256 1c34268e4e72b176ab0f98441b2bf5df51e01cd06e4f8b9917351d2a86c59b0b

See more details on using hashes here.

File details

Details for the file decpys-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: decpys-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

File hashes

Hashes for decpys-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a2a22fc66f2b72ce764e01d2d473f471290008a8bf149f95c032dc359e34376
MD5 a4c15b4bbbf12cc9edbb61cb08485e9e
BLAKE2b-256 e96acda561de4d37368f069cd0a649a819e753726eb0648b8ccc06b21fa79b86

See more details on using hashes here.

Supported by

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