Commit 7f078368 by nzy

Fix Print Grid

parent 7182bd82
......@@ -14,7 +14,7 @@ colors = ["#000000", "#0000FF", "#FF0000", "#008000", "#FFFF00",
"#808080", "#FFC0CB", "#FFA500", "#008080", "#800000"]
def array_to_str(matrix):
if np.issubdtype(matrix.dtype, np.integer):
try:
text = Text()
if matrix.ndim == 2:
for row in list(matrix):
......@@ -24,8 +24,10 @@ def array_to_str(matrix):
elif matrix.ndim == 1:
for pixel in list(matrix):
text.append("⬛", style=colors[pixel])
return text
else:
raise NotImplementedError
return text
except Exception:
return Text(str(matrix))
def rich_dumps(obj):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment