diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-12-29 12:32:38 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-12-29 12:32:38 (GMT) |
| commit | 632ec713a40f204aabf4779a6eda83974878e66c (patch) | |
| tree | ed35cfe8f04e0aa845c6c2d817a4a628a5a1525a /wasp/apps | |
| parent | 3ddb7fc13d3eb3bd37c5e9fee189dd4d8d7297bd (diff) | |
widgets: Checkbox: Add a simple checkbox widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps')
| -rw-r--r-- | wasp/apps/testapp.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py index 6b813e4..841dcea 100644 --- a/wasp/apps/testapp.py +++ b/wasp/apps/testapp.py @@ -25,10 +25,12 @@ class TestApp(): ICON = icons.app def __init__(self): - self.tests = ('Alarm', 'Button', 'Crash', 'Colours', 'Fill', 'Fill-H', 'Fill-V', 'Free Mem', 'Line', 'Notifications', 'RLE', 'String', 'Touch', 'Wrap') + self.tests = ('Alarm', 'Button', 'Checkbox', 'Crash', 'Colours', 'Fill', 'Fill-H', 'Fill-V', 'Free Mem', 'Line', 'Notifications', 'RLE', 'String', 'Touch', 'Wrap') self.test = self.tests[0] self.scroll = wasp.widgets.ScrollIndicator() + self._checkbox = wasp.widgets.Checkbox(4, 104, 'Check me') + self._sliders = ( wasp.widgets.Slider(32, 10, 90, 0xf800), wasp.widgets.Slider(64, 10, 140, 0x27e4), @@ -72,7 +74,9 @@ class TestApp(): self._draw() def touch(self, event): - if self.test == 'Colours': + if self.test == 'Checkbox': + self._checkbox.touch(event) + elif self.test == 'Colours': if event[2] > 90: s = self._sliders[(event[2] - 90) // 50] s.touch(event) @@ -221,7 +225,9 @@ class TestApp(): if self.test == 'Alarm': draw.string("Press button to", 12, 24+24) draw.string("set alarm.", 12, 24+48) - if self.test == 'Crash': + elif self.test == 'Checkbox': + self._checkbox.draw() + elif self.test == 'Crash': draw.string("Press button to", 12, 24+24) draw.string("throw exception.", 12, 24+48) elif self.test == 'Colours': |
