From ed6b126e2e19cff12fa0af6e9ddcb29e7aff4fc9 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sun, 3 Jan 2021 14:50:04 +0000 Subject: 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 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 -- cgit v0.10.2