From a119c5ed82be8c272cc1e2aed489077a85f15e50 Mon Sep 17 00:00:00 2001 From: "lion.chan" Date: Fri, 28 Apr 2023 11:25:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=83=8C=E6=99=AF=E8=89=B2?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lion.chan --- .../pyBoard/Demo/01Studio中文显示例程/tftch.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Ecology/01Studio/pyBoard/Demo/01Studio中文显示例程/tftch.py b/Ecology/01Studio/pyBoard/Demo/01Studio中文显示例程/tftch.py index df6d9c1..2c65fee 100644 --- a/Ecology/01Studio/pyBoard/Demo/01Studio中文显示例程/tftch.py +++ b/Ecology/01Studio/pyBoard/Demo/01Studio中文显示例程/tftch.py @@ -8,7 +8,7 @@ WHITE = (255, 255, 255) def printCh(display, text, x, y, dic={}, size=1, color=(0,0,0), backcolor=(255,255,255)): font_size = [0, 16, 24, 32, 40, 48] # 分别对应 size=1, 2, 3, 4, 5 的字体尺寸,0 无效。 xs = x - # 定义字体颜色,RGB888转RGB565 + # 定义字体颜色, RGB888 转 RGB565 fc = ((color[0]>>3)<<11) + ((color[1]>>2)<<5) + (color[2]>>3) # 字体 bc = ((backcolor[0]>>3)<<11) + ((backcolor[1]>>2)<<5) + (backcolor[2]>>3) # 字体背景颜色 # @@ -33,7 +33,7 @@ def printCh(display, text, x, y, dic={}, size=1, color=(0,0,0), backcolor=(255,2 # xs += font_size[size] else: - display.printStr(text[i], xs, y, color, size=size) + display.printStr(text[i], xs, y, color, backcolor=backcolor, size=size) xs += int(font_size[size]/2) # if # for @@ -43,11 +43,10 @@ if __name__ == '__main__': import fonts from tftlcd import LCD24 ######################## - # 构建1.5寸LCD对象并初始化 + # 构建 2.4 寸 LCD 对象并初始化 ######################## - d = LCD24(portrait=1) #默认方向竖屏 - # - #填充白色 + d = LCD24(portrait=1) # 默认方向竖屏 + # 填充白色 d.fill(BLACK) # printCh(d, '零一科技01Tech', 0, 0, dic=fonts.hanzi_16x16_dict, size=1, color=RED, backcolor=BLACK)