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.1.0.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for pyqt_reactivity-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd8399c3d9301f5d6c0ac16e049eabf07584c5ee2d82dc185519908897873a38 |
|
MD5 | 2f3e0877aeedd82fbe0cb3f1e5752c6e |
|
BLAKE2b-256 | cb74ff6ca97a5d3f13b698f6c6f7da07d9503f7d516689fef14d580825b16d0c |