def onelinePrint(self, s, base_x, base_y): lcd.rect(0, base_y, base_x, 26, 0x000000, 0x000000) x_pos = self.printStr(s, base_x, base_y, 2) width = 320 - x_pos if width > 0: lcd.rect(x_pos, base_y, width, 26, 0x000000, 0x000000) return x_pos
def printChar(self, char, base_x, base_y): if self.hankaku.find(char) != -1: char = self.zenkaku[self.hankaku.find(char)] fontData = None if char in self.fontDataCache: #キャッシュにあったらそれ使う fontData = self.fontDataCache[char] else: if ord(char) < 65536: #フォントの位置取得 self.fontCodeFile.seek((ord(char) - 1) * 2) fontIndex = int.from_bytes(self.fontCodeFile.read(2), "big") #フォントデータ取得 self.fontFile.seek(fontIndex * 26) fontData = self.fontFile.read(26) if len(self.fontDataCache) < 100: self.fontDataCache[char] = fontData #フォントキャッシュ100個までにしておく if fontData is not None: y = 0 index = 0 for fontDataByte in fontData: if index % 2 == 0: fontData_line = fontDataByte << 8 index = index + 1 continue else: fontData_line = fontData_line + fontDataByte for x in range(15): if fontData_line >> (15 - x) & 1 == 1: #ビット上側から、1か0かチェック lcd.rect((x + base_x) * 2, (y + base_y) * 2, 2, 2) #1ならその位置にドット打つ index = index + 1 y = y + 1
def header(tx, setclip): # adjust screen dimensions (depends on used display and orientation) global maxx, maxy, miny maxx, maxy = lcd.screensize() lcd.clear() if maxx < 240: lcd.font(lcd.FONT_Small, rotate=0) else: lcd.font(lcd.FONT_Default, rotate=0) _, miny = lcd.fontSize() miny += 5 lcd.rect(0, 0, maxx - 1, miny - 1, lcd.OLIVE, lcd.DARKGREY) lcd.text(lcd.CENTER, 2, tx, lcd.CYAN, transparent=True) if setclip: lcd.setwin(0, miny, maxx, maxy)
def clear(self): ##TODO self._last_xy = self.rect[0:2] lcd.rect(self.rect[0], self.rect[1], self.rect[2], self.rect[3], color=self.back_color, fillcolor=self.back_color)
def __drawNaviBar(self, currentPage): h_bar = self.downright[1] - self.upleft[1] h_lever = int(h_bar / int(len(self.selections) / self.MIOP + 1)) lcd.rect(308, self.upleft[1], self.downright[0] - self.upleft[0], h_bar, lcd.WHITE, lcd.WHITE) lcd.rect(308, self.upleft[1] + h_lever * (currentPage - 1), self.downright[0] - self.upleft[0], h_lever, lcd.WHITE, lcd.DARKGREY)
def drawNaviButton(self, strA='UP', strB='DOWN', strC='SELECT'): lcd.rect(0, self.H - self.h_bottom, self.W, self.h_bottom, lcd.DARKGREY, lcd.DARKGREY) lcd.line(int(self.W / 3), self.H - self.h_bottom, int(self.W / 3), self.H, lcd.WHITE) lcd.line(int(2 * self.W / 3), self.H - self.h_bottom, int(2 * self.W / 3), self.H, lcd.WHITE) lcd.text(40, 215, strA, lcd.WHITE) lcd.text(135, 215, strB, lcd.WHITE) lcd.text(240, 215, strC, lcd.WHITE)
def update(self, value): '''温度計の表示値を再描画する。 ''' # 温度計の縦棒の一番上のy座標を計算する y1 = self._calc_y(value) # 描画する lcd.rect(self.bar_x, y1, self.bar_width, self.circle_y - y1, self.color, self.color) lcd.rect(self.bar_x, self.y, self.bar_width, y1 - self.y, self.background_color, self.background_color)
def graph(): global offset global rate reg = register for ic in range(0, 8): for ir in range(0, 8): val = ustruct.unpack('<h', i2c.readfrom_mem(i2c_address, reg, 2))[0] tmp = (getval(val) - offset) * rate if tmp < 0: tmp = 0 if 127 < tmp: tmp = 127 lcd.rect((8-ic) * 30 + 40, ir * 30, 30, 30, 0, colors[int(tmp)]) reg += 2
def graph(): global offset global rate reg = register for ic in range(0, 8): for ir in range(0, 8): val = ustruct.unpack('<h', i2c.readfrom_mem(i2c_address, reg, 2))[0] tmp = (getval(val) - offset) * rate if tmp < 0: tmp = 0 if 127 < tmp: tmp = 127 lcd.rect((8 - ic) * 30 + 40, ir * 30, 30, 30, 0, colors[int(tmp)]) reg += 2
def app_txtReader(self, fname): lcd.clear() f = Framework('txtReader') f.drawNaviButton(strC='EXIT') lcd.font(lcd.FONT_DefaultSmall, transparent=False, fixedwidth=True) idx = 0 idx_s = [0] page = 0 while True: letter_current_page = 0 lcd.setCursor(0, 0) lcd.rect(0, 0, 320, 240 - f.h_bottom, lcd.BLACK, lcd.BLACK) with open(fname, 'r') as o: o.seek(idx) flag_end = False for row in range(20): for col in range(29): c = o.read(1) if not c: lcd.println('--- END ---') flag_end = True break if c != '\n': lcd.print(c) letter_current_page += 1 else: letter_current_page += 1 break lcd.print('\n') if flag_end: break while True: time.sleep(0.1) if buttonA.isPressed(): if page != 0: page -= 1 del (idx_s[-1]) idx = idx_s[-1] break elif buttonB.isPressed(): if c: idx += letter_current_page idx_s.append(idx) page += 1 break elif buttonC.isPressed(): return 0
def printMenu(self): self._menuItems = self.__filterMenuItems(self.getMenuItems()) self._min = 1 self._max = len(self._menuItems) lcd.font(lcd.FONT_DejaVu24, transparent=True) lcd.rect(self.cursor[0], self.cursor[1], 320, 240, lcd.WHITE, lcd.WHITE) lcd.setCursor(self.cursor[0], self.cursor[1]) for i in range(self._max): selectedPrefix = ' ' if (i + 1) == self.value: selectedPrefix = '>' lcd.println('{} {}'.format(selectedPrefix, self._menuItems[i][0]))
def draw_graph(resp, timeStart, timeEnd): # Coloured background for high/low areas lcd.rect(0, SCREEN_HEIGHT - GRAPH_HEIGHT, GRAPH_WIDTH, GRAPH_HEIGHT - WARN_HIGH_Y, YELLOW, YELLOW) lcd.rect(0, SCREEN_HEIGHT - WARN_LOW_Y, GRAPH_WIDTH, WARN_LOW_Y, RED, RED) # Prints lines between graph sections. # lcd.line(0, SCREEN_HEIGHT - GRAPH_HEIGHT, GRAPH_WIDTH, SCREEN_HEIGHT - GRAPH_HEIGHT) # lcd.line(0, SCREEN_HEIGHT - WARN_HIGH_Y, GRAPH_WIDTH, SCREEN_HEIGHT - WARN_HIGH_Y) # lcd.line(0, SCREEN_HEIGHT - WARN_LOW_Y, GRAPH_WIDTH, SCREEN_HEIGHT - WARN_LOW_Y) for idx, point in enumerate(resp): x = round(GRAPH_WIDTH * (int(point["date"] / 1000) - timeStart) / (timeEnd - timeStart)) y = round(min(point["sgv"] / GRAPH_MAX, 1.0) * GRAPH_HEIGHT) lcd.circle(x, SCREEN_HEIGHT - y, 3, BLACK, BLACK)
def multiprint(self, s, base_x, base_y, scale=1): '''文字をM5StackのLCDに出力 Arguments: s -- Strings base_x : int -- X出力基準位置 base_y : int -- Y出力基準位置 Keyword Arguments: scale {int} -- 文字大きさ (default: {1}) Returns: [int] -- 文字列が使用するpixel数 ''' self._get_ff(s) for c in s: if ord(c) < 256: width = 7 else: width = 15 y = 0 if base_x > 320: base_x = base_x + 2 * width continue for i in range(13): d = int.from_bytes(self.ff_set[c][2 * i:2 * (i + 1)], 'little') for x in range(width): if base_x + x * 2 * scale < 0: continue if base_x + x * 2 * scale >= 320: continue if d >> (width - x) & 1 == 1: lcd.rect(base_x + x * 2 * scale, base_y + y * 2, 2 * scale, 2 * scale, 0xFFFFFF, 0xFFFFFF) # print('@@', end='') else: lcd.rect(base_x + x * 2 * scale, base_y + y * 2, 2 * scale, 2 * scale, 0x000000, 0x000000) # print(' ', end='') # print('') y = y + scale base_x = base_x + 2 * scale * width return base_x
def __th_display(self, apresults): if self.FLAG_END == 0: print(self.strBuf+'---------------------') lcd.rect(0,0,320,210, lcd.BLACK, lcd.BLACK) lcd.setCursor(0,0) lcd.font(lcd.FONT_DefaultSmall) if len(apresults) < 15: i = 0 for apresult in apresults: resstr = '%02d, ch: %02d, rs: %d, %s\n' % (i+1, apresult[2], apresult[3], apresult[0].decode()) lcd.print(resstr,color = lcd.WHITE) i = i + 1 else: for i in range(0,15): apresult = apresults[i] resstr = '%02d, ch: %02d, rs: %d, %s\n' % (i+1, apresult[2], apresult[3], apresult[0].decode()) lcd.print(resstr,color = lcd.WHITE) return 0
def printChar(self, char): if self.hankaku.find(char) != -1: char=self.zenkaku[self.hankaku.find(char)] fontData = None if ord(char) < 65536: #フォントの位置取得 self.fontCodeFile.seek((ord(char)-1) * 2) fontIndex = int.from_bytes(self.fontCodeFile.read(2), "big") #フォントデータ取得 self.fontFile.seek(fontIndex * 8) fontData = self.fontFile.read(8) if fontData is not None: fontDataList = [] y = 0 index = 0 for fontDataByte in fontData: for x in range(8): if fontDataByte >> (7 - x) & 1 == 1: #ビット上側から、1か0かチェック fontDataList.append(1) else: fontDataList.append(0) for offset in range(8): smaponDataList = self.makeSmaponDataList(self.prevDataList); for y in range(8): for x in range(8): if smaponDataList[x + y * 8] == 1: lcd.rect(68 + x * 23,28 + y * 23,15,15,lcd.WHITE,lcd.WHITE) else: lcd.rect(68 + x * 23,28 + y * 23,15,15,lcd.BLACK,lcd.BLACK) #prevListを左にずらし、右から新しい内容をセット for y in range(8): for x in range(8): if x != 7: self.prevDataList[x + y * 8] = self.prevDataList[x +1 + y * 8] else: self.prevDataList[x + y * 8] = fontDataList[offset + y * 8] sleep(0.05)
def rectDemo(sec=5, dofill=False): tx = "RECTANGLE" if dofill: tx = "FILLED " + tx header(tx, True) n = time.time() + sec while time.time() < n: x = machine.random(4, maxx - 2) y = machine.random(miny, maxy - 2) w = machine.random(2, maxx - x) h = machine.random(2, maxy - y) color = machine.random(0xFFFFFF) if dofill: fill = machine.random(0xFFFFFF) lcd.rect(x, y, w, h, color, fill) else: lcd.rect(x, y, w, h, color) if buttonA.wasPressed(): break lcd.resetwin()
def resdisplay(apresults, n, time): lcd.rect(0, 0, 320, 24, lcd.BLUE, lcd.BLUE) lcd.font(lcd.FONT_Ubuntu, transparent=True) lcd.text(0, 2, 'N_AP:%d N_SCAN:%d TIME:%d' % (len(apresults), n, time), lcd.WHITE) lcd.rect(0, 24, 320, 186, lcd.BLACK, lcd.BLACK) lcd.setCursor(0, 24) lcd.font(lcd.FONT_DefaultSmall) if len(apresults) < 15: i = 0 for apresult in apresults: resstr = '%02d, ch: %02d, rs: %d, %s\n' % ( i + 1, apresult[2], apresult[3], apresult[0].decode()) lcd.print(resstr, color=lcd.WHITE) i = i + 1 else: for i in range(0, 15): apresult = apresults[i] resstr = '%02d, ch: %02d, rs: %d, %s\n' % ( i + 1, apresult[2], apresult[3], apresult[0].decode()) lcd.print(resstr, color=lcd.WHITE)
def wifi(self, x, y, size, color=lcd.WHITE): lcd.setCursor(x, y) lcd.rect(x, int(y + .75 * size), int(size * .2), size - int(y + .75 * size), color, color) lcd.rect(int(x + .4 * size), int(y + .5 * size), int(size * .2), size - int(y + .5 * size), color, color) lcd.rect(int(x + .8 * size), int(y), int(size * .2), size, color, color)
def __init__(self): initDataList = [ 1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,1, 1,1,1,1,1,1,1,1 ] self.fontFile = open("/sd/misakiFontData8x8.bin", "rb") self.fontCodeFile = open("/sd/misakiFontCode8x8.bin", "rb")#Unicodeコード→フォント並び順変換 self.zenkaku="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&’()*+,-./:;<=>?@[¥]^_‘{|}~ 0123456789" self.hankaku="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()*+,-./:;<=>?@[\]^_`{|}~ 0123456789" self.prevDataList = initDataList[:] smaponDataList = self.makeSmaponDataList(initDataList) for y in range(8): for x in range(8): if smaponDataList[x + y * 8] == 1: lcd.rect(68 + x * 23,28 + y * 23,15,15,lcd.WHITE,lcd.WHITE) else: lcd.rect(68 + x * 23,28 + y * 23,15,15,lcd.BLACK,lcd.BLACK) sleep(10)
def draw(self,index): a,b=divmod(len(self.applist),self.lines) A,B=divmod(index,self.lines) if A == a: frontlist=self.applist[A*self.lines:] else: frontlist=self.applist[A*self.lines:(A+1)*self.lines] if self.previous_index is None: self.clear() lcd.font(self.font, fixedwidth=0) for i in range(len(frontlist)): print(i,frontlist[i],end=" ") if i == B: lcd.setColor(self.color_2[0],self.color_2[1]) lcd.rect(self.x,self.y+B*self.fontheight,self.length,self.fontheight,self.color_2[1],self.color_2[1]) if frontlist[i][0]=="/sd": lcd.text(self.x,self.y+i*self.fontheight,"SD-"+frontlist[i][1][:-4]) else: lcd.text(self.x, self.y + i * self.fontheight, "FLASH-" + frontlist[i][1][:-7]) else: lcd.setColor(self.color_1[0], self.color_1[1]) lcd.rect(self.x, self.y + i * self.fontheight, self.length,self.fontheight,self.color_1[1], self.color_1[1]) if frontlist[i][0]=="/sd": lcd.text(self.x,self.y+i*self.fontheight,"SD-"+frontlist[i][1][:-4]) else: lcd.text(self.x, self.y + i * self.fontheight, "FLASH-" + frontlist[i][1][:-7]) self.previous_index=index else: if A != divmod(self.previous_index, self.lines)[0]: self.previous_index = None self.draw(index) else: pb = divmod(self.previous_index, self.lines)[1] lcd.setColor(self.color_1[0], self.color_1[1]) lcd.rect(self.x, self.y + pb * self.fontheight,self.length,self.fontheight,self.color_1[1], self.color_1[1]) if frontlist[pb][0] == "/sd": lcd.text(self.x, self.y + pb * self.fontheight, "SD-" + frontlist[pb][1][:-4]) else: lcd.text(self.x, self.y + pb * self.fontheight, "FLASH-" + frontlist[pb][1][:-7]) lcd.setColor(self.color_2[0], self.color_2[1]) lcd.rect(self.x, self.y + B * self.fontheight, self.length,self.fontheight,self.color_2[1], self.color_2[1]) if frontlist[B][0] == "/sd": lcd.text(self.x, self.y + B * self.fontheight, "SD-" + frontlist[B][1][:-4]) else: lcd.text(self.x, self.y + B * self.fontheight, "FLASH-" + frontlist[B][1][:-7]) self.previous_index=index
async def display_task(): while True: lcd.font(lcd.FONT_DejaVu24) fw, fh = lcd.fontSize() lcd.setTextColor(color=lcd.BLACK, bcolor=lcd.WHITE) lcd.text(0, 0, 'SmartMeter: ' + bp35_state + '\r') lcd.rect(0, fh, 320, 2, 0, 0) lcd.setTextColor(color=lcd.WHITE, bcolor=lcd.BLACK) lcd.text(319 - fw * 1, 90, 'W') lcd.text(319 - fw * 3, 150, 'kWh') lcd.font(lcd.FONT_7seg, transparent=False, dist=25, width=5, outline=False) sfw, sfh = lcd.fontSize() if last_instant_power is not None: if last_instant_power >= 1500: lcd.setTextColor(color=lcd.RED) else: lcd.setTextColor(color=lcd.WHITE) lcd.text(40, fh + 4, '{0:04d}'.format(last_instant_power)) else: lcd.setTextColor(color=lcd.WHITE) lcd.text(40, fh + 4, '----') lcd.setTextColor(color=lcd.WHITE) lcd.rect(0, fh + sfh + 4, 320, 2, 0xffffff, 0xffffff) lcd.font(lcd.FONT_7seg, transparent=False, dist=15, width=3, outline=False) if last_cumulative_power is not None: lcd.text(40, fh + sfh + 10, '{0:06.1f}'.format(last_cumulative_power)) else: lcd.text(40, fh + sfh + 10, '------') lcd.rect(0, 180, 320, 2, 0xffffff, 0xffffff) # if last_instant_current is not None: # lcd.text(0, font_size[1]*3, 'Current: R={0},T={1}[A]'.format(last_instant_current[0]/10,last_instant_current[1]/10)) gc.collect() await asyncio.sleep_ms(100)
def drawBanner(self): lcd.rect(0, 0, self.W, self.h_banner, lcd.BLUE, lcd.BLUE) lcd.setCursor(self.W - lcd.textWidth(self.title) - 5, 5) lcd.print(self.title) th_m = _thread.start_new_thread('monitor', self.__th_statusMonitor, ())
def clear(self): lcd.rect(self.x,self.y,self.length,self.width,self.color_1[1],self.color_1[1])
# ライブラリ導入 from m5stack import lcd # 初期化 lcd.clear() # フォント指定 lcd.font(lcd.FONT_Dejavu24) # フォント FONT_Dejavu24 に設定 # 画像挿入 lcd.image(lcd.CENTER, lcd.BOTTOM, file="/flash/icon.jpg") # 見出し lcd.setCursor(0, 0) lcd.setColor(lcd.WHITE, lcd.BLUE) fw, fh = lcd.fontSize() ww, wh = lcd.winsize() lcd.rect(0, 0, ww, fh + 1, lcd.BLUE, lcd.BLUE) lcd.println("N High School students Card") # 文字 lcd.setColor(lcd.WHITE, lcd.BLACK) lcd.print('Waricoma', 10, 30)
def main(): ########## 初期化 ########## # 液晶画面を初期化する lcd.setColor(color, background_color) lcd.clear() # センサーを初期化する sensor = DHT12() # 温度計、湿度計の表示を初期化する temperature_view = ThermometerView(10, 10, min_value=-15, max_value=45) humidity_view = ThermometerView(80, 10, min_value=0, max_value=100, color=lcd.BLUE, label='%') # SDカードのマウント uos.mountsd() # 背景の描画 temperature_view.init() humidity_view.init() ########## 無限ループ ########## while not buttonC.isPressed(): # センサーで温度と湿度を計測する sensor.measure() temperature = sensor.temperature() humidity = sensor.humidity() # デバッグ用 print("Temperature: {} `C, Humidity: {} %".format( temperature, humidity)) # 温度計、湿度計の表示を更新する temperature_view.update(temperature) humidity_view.update(humidity) # WBGT値を求める try: wbgt = calc_wbgt(temperature, humidity) except ValueError: wbgt = None # WBGT値を画面に表示する lcd.font(lcd.FONT_Default, color=color, transparent=False) lcd.textClear(160, 30, 'WBGT: Unknown') if wbgt is not None: lcd.text(160, 30, 'WBGT: {}'.format(wbgt)) else: lcd.text(160, 30, 'WBGT: Unknown') image_path = None # WBGT値に応じて画像を描画する # 31度以上 : 危険 # 28度以上31度未満 : 厳重警戒 # 25度以上28度未満 : 警戒 # 25度未満 : 注意 if temperature >= 21 and wbgt is not None: if wbgt >= 31: # 危険 image_path = image_path_kiken elif wbgt >= 28: # 厳重警戒 image_path = image_path_genjukeikai elif wbgt >= 25: # 警戒 image_path = image_path_keikai # 湿度に応じてインフルエンザ注意情報を表示する # 湿度40%未満 : インフルエンザ感染注意 if humidity < 40: image_path = image_path_influenza if image_path is not None: # 画像を描画する lcd.image(image_x, image_y, image_path) else: # 画像を描画した領域を背景色で塗りつぶす lcd.rect(image_x, image_y, image_width, image_height, background_color, background_color) # 表示の更新間隔 utime.sleep(interval)
lcd.BLUE) lcd.image(110, 85, "/flash/images/%s.jpg" % (icon_basename), 0, lcd.JPG) lcd.font(lcd.FONT_DefaultSmall, transparent=True, fixedwidth=True) lcd.text(lcd.CENTER, 160, "~06 | ~12 | ~18 | ~24 ", lcd.BLACK) lcd.text( lcd.CENTER, 180, "%3s | %3s | %3s | %3s " % (rains["t00_06"], rains["t06_12"], rains["t12_18"], rains["t18_24"]), lcd.BLACK) lcd.font(lcd.FONT_Default, transparent=True, fixedwidth=False) lcd.text(lcd.CENTER, 220, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), lcd.DARKGREY) while True: if counter == 1500: counter = 0 if counter == 0: render() counter += 1 time.sleep_ms(1000) lcd.rect(0, 220, 80, 20, lcd.WHITE, lcd.WHITE) lcd.font(lcd.FONT_Default, transparent=True, fixedwidth=False) lcd.text(10, 220, "%04d" % (counter), lcd.DARKGREY)
from m5stack import lcd # LCD # setup lcd.clear(0xC70039) lcd.fill(0x222222) # lcd.arc(0, 0, 10, 30, 40, 0) lcd.circle(290, 150, 20) lcd.ellipse(260, 50, 10, 10) #comment # lcd.font(lcd.FONT_Comic) // not working # fontSize = lcd.fontSize(); // not working lcd.line(10, 100, 50, 40) lcd.lineByAngle(100, 100, 5, 50, 180) lcd.pixel(200, 200, 0xAABBFF) # lcd.polygon(10, 10, 30, 30, 10) # comment lcd.print('hello world', 130, 50) lcd.rect(50, 100, 150, 100, 0xEEFFFF) lcd.triangle(200, 0, 10, 20, 50, 80, 0xFFFFFF)
def resetScreen(self, cursor: [] = [0, 85]): lcd.rect(cursor[0], cursor[1], 320, 240, lcd.WHITE, lcd.WHITE) lcd.setCursor(cursor[0], cursor[1])
def __drawBackground(self): lcd.rect(self.upleft[0], self.upleft[1], self.downright[0] - self.upleft[0], self.downright[1] - self.upleft[1], lcd.BLACK, lcd.BLACK)
def alert(self, text): lcd.rect(0, 0, 320, 240, lcd.DARKGREY, lcd.DARKGREY) lcd.println(text, lcd.CENTER, color=lcd.RED) lcd.println('Long press \"A\" to exit', lcd.CENTER, color=lcd.BLACK) while not buttonA.isPressed(): time.sleep(1)
def _print_core(self, strings, font_path, font_size=8, rect=(0, 0, 320, 240), fg=0xFFFFFF, bg=0x000000, append=False): SDFont = sdfonts_py.SDFonts() SDFont.open(font_path) SDFont.setFontSize(font_size) start_x, start_y = rect[0:2] end_x = rect[0] + rect[2] end_y = rect[1] + rect[3] if append: if self._last_xy is None: ##TODO self.clear() ##TODO x, y = self._last_xy else: x, y = start_x, start_y ## Fill backgound lcd.rect(rect[0], rect[1], rect[2], rect[3], color=bg, fillcolor=bg) ## lcd.rect(x=rect[0], y=rect[1], ## width=rect[2], height=rect[3], ## color=bg, fillcolor=bg) bg = None for s in strings: ## NextLine if s == "\n": x = start_x y += font_size continue b = SDFont.getFontData(s) if b is None: continue w = SDFont.getWidth() h = SDFont.getHeight() self._putc(b, x=x, y=y, fg=fg, bg=bg, w=w, h=h) x += w if x > end_x: x = start_x y += h if y > end_y: y = start_y if append: self.clear() ## go top ##TODO else: break ## over self._last_xy = (x, y) SDFont.close()