Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@TristanAmond
Created March 1, 2023 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TristanAmond/f0c6f403ab8658cce718937c76562fab to your computer and use it in GitHub Desktop.
Save TristanAmond/f0c6f403ab8658cce718937c76562fab to your computer and use it in GitHub Desktop.
basic driver for MatrixPortal M4 LED panel project
import displayio
import terminalio
from adafruit_display_text.label import Label
from adafruit_bitmap_font import bitmap_font
# Initialize display_manager class
class display_manager(displayio.Group):
def __init__(
self,
display,
):
super().__init__()
self.display = display
# set up label groups
self.root_group = displayio.Group()
self.root_group.append(self)
self._label_group = displayio.Group(x=4, y=8)
self.append(self._label_group)
# set up text label
self.label_text = Label(terminalio.FONT)
self.label_text.color = 0xFFFFFF
self._label_group.append(self.label_text)
# update text in the text label
def update_label(self, input_text):
self.label_text.text = input_text
# refresh the root group on the display
def refresh_display(self):
self.display.show(self.root_group)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment