summaryrefslogtreecommitdiff
path: root/wasp
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2021-01-03 14:50:04 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2021-01-03 14:50:04 (GMT)
commited6b126e2e19cff12fa0af6e9ddcb29e7aff4fc9 (patch)
tree96358f075ff85470b22799c0c04edefa91c6b140 /wasp
parent75a1a15f451a07eabdba3a3207f1849a06254410 (diff)
widgets: checkbox: Add a label property
The checkbox uses the _im(mutable) idiom to minimize the RAM overhead of its immutable properties (position and label). However it can be useful to retrieve the label to provide a property accessor. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp')
-rw-r--r--wasp/widgets.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/wasp/widgets.py b/wasp/widgets.py
index 07bdf0c..8509fbb 100644
--- a/wasp/widgets.py
+++ b/wasp/widgets.py
@@ -221,6 +221,10 @@ class Checkbox():
self._im = (x, y, label)
self.state = False
+ @property
+ def label(self):
+ return self._im[2]
+
def draw(self):
"""Draw the checkbox and label."""
draw = wasp.watch.drawable