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>
This commit is contained in:
Daniel Thompson 2021-01-03 14:50:04 +00:00
parent 75a1a15f45
commit ed6b126e2e

View file

@ -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