From ae0d59dbe3880abdea536ced5ff3cacfc0fc059d Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sun, 20 Jun 2021 17:08:39 +0100 Subject: [PATCH] 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 --- wasp/widgets.py | 4 ++-- 1 file 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):