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:
parent
75a1a15f45
commit
ed6b126e2e
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue