From 9c32edfdd54e0ad22fed09c33262f5963accfaf6 Mon Sep 17 00:00:00 2001 From: Diego Roversi Date: Sun, 3 May 2020 11:57:32 +0200 Subject: display: more conversion from string to bytearray --- display/dpy_pygame.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'display/dpy_pygame.py') diff --git a/display/dpy_pygame.py b/display/dpy_pygame.py index 498b5dc..a3c2a1f 100644 --- a/display/dpy_pygame.py +++ b/display/dpy_pygame.py @@ -72,7 +72,8 @@ class Display: def pixmap(self, w, h, data, colorkey=-1): print(f"pixmap type(data) = {type(data)}, data={data[:128]}", file=sys.stderr) - img = pygame.image.fromstring(data, (w, h), "RGB") + print(f"pixmap len(data) = {len(data)}, (h, w) = {(h, w)}", file=sys.stderr) + img = pygame.image.fromstring(data[:w*h*3], (w, h), "RGB") if colorkey >= 0: r = colorkey & 0xFF g = (colorkey >> 8) & 0xFF -- cgit v1.2.3