Skip to content

Commit 9eda831

Browse files
committed
fixed post_frame
1 parent fa055bb commit 9eda831

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/fluepdot/fluepdot.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,18 @@ def post_frame_raw(self, frame: str) -> Response:
9191

9292

9393
def post_frame(self, frame: List[List[bool]]) -> Response:
94-
data: List[List[str]] = [[" "] * width for _ in range(height)]
95-
for x, l in frame:
96-
for y, b in l:
94+
data: List[List[str]] = [[" "] * self.width for _ in range(self.height)]
95+
for x, l in enumerate(frame):
96+
for y, b in enumerate(l):
9797
if b:
9898
try:
99-
data[x, y] = "X"
99+
data[x][y] = "X"
100100
except IndexError as e:
101101
print(e)
102-
return self._post(frameURL, post=data)
102+
outStr = ""
103+
for line in data:
104+
outStr = outStr + "".join(line) + "\n"
105+
return self._post(frameURL, post=outStr)
103106

104107

105108
def set_pixel(x: int = 0, y: int = 0) -> Response:

0 commit comments

Comments
 (0)