diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-06-20 16:08:39 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-06-20 16:08:39 (GMT) |
| commit | ae0d59dbe3880abdea536ced5ff3cacfc0fc059d (patch) | |
| tree | 0ded75363e08c74756532a1fa8d7012e1502fce4 | |
| parent | 9099c2398e5a169db95ef6b36cda4c44e47a32d1 (diff) | |
widgets: Further compact some of the internal representations
Many widgets adopted the _im(mutable) idiom to allow us to reduce the
RAM overhead of each widget. Where the immutable data considers entirely
of integers smaller than 256 then we can push this just a little further
by switching from a tuple to a bytes.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
| -rw-r--r-- | wasp/widgets.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/wasp/widgets.py b/wasp/widgets.py index 496b229..01d20a8 100644 --- a/wasp/widgets.py +++ b/wasp/widgets.py @@ -305,7 +305,7 @@ class Checkbox(): class GfxButton(): """A button with a graphical icon.""" def __init__(self, x, y, gfx): - self._im = (x, y) + self._im = bytes((x, y)) self.gfx = gfx def draw(self): @@ -410,7 +410,7 @@ class Spinner(): widget and requires 60x120 px. """ def __init__(self, x, y, mn, mx, field=1): - self._im = (x, y, mn, mx, field) + self._im = bytes((x, y, mn, mx, field)) self.value = mn def draw(self): |
