def message(self, text): self._text += text fixed_text = self._text # limit text to lcd's dimensions (lines and columns) lines = self._text.split("\n") del lines[self._lines:] lines = [line[0:self._columns] for line in lines] fixed_text = "\n".join(lines) app = TkCircuit() app.update_lcds(self._pins, fixed_text)
def message(self, text): text_with_special_characters = "" for character in text: if character != "\n": code = ord(character) code = code % 255 character = chr(code) if code <= 31 or (code >= 128 and code <= 161): character = " " text_with_special_characters += character self._text += text_with_special_characters fixed_text = self._text # limit text to lcd's dimensions (lines and columns) lines = self._text.split("\n") del lines[self._lines:] lines = [line[0:self._columns] for line in lines] fixed_text = "\n".join(lines) app = TkCircuit() app.update_lcds(self._pins, fixed_text)
def clear(self): self._text = "" app = TkCircuit() app.update_lcds(self._pins, self._text)