Skip to content

Commit 3bab3ad

Browse files
committed
更新:函数名 font 更改为 text
1 parent e254f1f commit 3bab3ad

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333

3434
### 示例代码
35+
3536
```python
3637
# 这是一个使用示例
3738
import time
@@ -40,17 +41,17 @@ from drivers import st7735
4041
from machine import SPI, Pin
4142
from libs.easydisplay import EasyDisplay
4243

43-
4444
spi = SPI(1, baudrate=20000000, polarity=0, phase=0, sck=Pin(1), mosi=Pin(0))
4545
dp = st7735.ST7735(width=160, height=128, spi=spi, cs=Pin(19), dc=Pin(18), rst=Pin(3), rot=1)
46-
ed = EasyDisplay(display=dp, font_file="/fonts/harmonyos_sans/harmonyos16.bmf", show=True, font_color=0xFFFF, clear=True,
46+
ed = EasyDisplay(display=dp, font_file="/fonts/harmonyos_sans/harmonyos16.bmf", show=True, font_color=0xFFFF,
47+
clear=True,
4748
img_format=framebuf.RGB565, img_color=0xFFFF)
4849

4950
ed.bmp("/img/test.bmp", 0, 0)
5051
time.sleep(3)
5152
ed.pbm("/img/test.pbm", 0, 0, format=framebuf.MONO_HLSB)
5253
time.sleep(3)
53-
ed.font("测试一下\nTest\nテスト", 0, 0)
54+
ed.text("测试一下\nTest\nテスト", 0, 0)
5455

5556
# 更多高级使用方式详见源码注释:/libs/easydisplay.py
5657
```

libs/easydisplay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def show(self):
8585
"""
8686
self.display.show()
8787

88-
def font(self, s: str, x: int, y: int, c: int = None, size: int = None, show: bool = None, clear: bool = None,
88+
def text(self, s: str, x: int, y: int, c: int = None, size: int = None, show: bool = None, clear: bool = None,
8989
reverse: bool = None, half_char: bool = None, auto_wrap: bool = None, alpha_bg: int = None):
9090
"""
9191
显示字体中的文字(请确保初始化时已加载字体文件)

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
time.sleep(3)
1616
ed.pbm("/img/test.pbm", 0, 0, format=framebuf.MONO_HLSB)
1717
time.sleep(3)
18-
ed.font("测试一下\nTest\nテスト", 0, 0)
18+
ed.text("测试一下\nTest\nテスト", 0, 0)
1919

2020
# 更多高级使用方式详见源码注释:/libs/easydisplay.py

0 commit comments

Comments
 (0)