t
This commit is contained in:
10
display.py
10
display.py
@@ -1,6 +1,7 @@
|
||||
import machine
|
||||
import st7789py as st7789
|
||||
from config import CURRENT_CONFIG
|
||||
import font
|
||||
|
||||
class Display:
|
||||
def __init__(self):
|
||||
@@ -8,6 +9,7 @@ class Display:
|
||||
self.width = 240
|
||||
self.height = 240
|
||||
self._init_display()
|
||||
self.font = font.Font()
|
||||
|
||||
def _init_display(self):
|
||||
print(">>> Initializing Display...")
|
||||
@@ -41,6 +43,14 @@ class Display:
|
||||
if self.tft:
|
||||
self.tft.fill_rect(x, y, w, h, color)
|
||||
|
||||
def set_ws(self, ws):
|
||||
if self.font:
|
||||
self.font.set_ws(ws)
|
||||
|
||||
def text(self, text, x, y, color):
|
||||
if self.tft:
|
||||
self.font.text(self.tft, text, x, y, color)
|
||||
|
||||
def init_ui(self):
|
||||
"""初始化 UI 背景"""
|
||||
if self.tft:
|
||||
|
||||
Reference in New Issue
Block a user