aboutsummaryrefslogtreecommitdiff
path: root/host/terminal.py
diff options
context:
space:
mode:
Diffstat (limited to 'host/terminal.py')
-rw-r--r--host/terminal.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/host/terminal.py b/host/terminal.py
new file mode 100644
index 0000000..86b4db1
--- /dev/null
+++ b/host/terminal.py
@@ -0,0 +1,19 @@
+from pixelterm.pixelterm import termify_pixels
+
+class MockImage:
+ def __init__(self, nparray):
+ self.nparray = nparray
+ self.im = self
+
+ @property
+ def size(self):
+ h, w, _ = self.nparray.shape
+ return (w, h)
+
+ def getpixel(self, pos):
+ x, y = pos
+ return tuple(self.nparray[y][x])
+
+def printframe(framedata):
+ print(termify_pixels(MockImage(framedata)))
+