Reactivity library for PyQT
Project description
pyqt-reactivity
Description
pyqt-reactivity is a project that aims to provide basic reactivity module for PyQt widgets.
Installation
Install the latest version from PyPI:
pip install -U pyqt-reactivity
Usage
To use basic reactivity module, see the following example:
from pyqt_reactivity import Ref, computed, ref
# Create a reactive reference.
a = ref(1)
a.watch(lambda v: print("a updated:", v))
# Define a computed function that depends on the reactive reference.
def a_squared(a: Ref[float]) -> float:
return a.value**2
# Create a computed reference.
b = computed(a_squared, args=(a,))
b.watch(lambda v: print("b updated:", v))
# Update the reactive reference.
a.value = 2
See more implementations on examples folder.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyqt_reactivity-0.2.0.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for pyqt_reactivity-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d2470a31f92ce5e8472e403ecde7b4c82bed00ac98c0485bd958939d17e2668 |
|
MD5 | ed57665820da84419339f4a58b4bfa09 |
|
BLAKE2b-256 | b8c4ccd8af575b00841f0487e69da60973bb2a811609ee93e868352d3337b7ee |