UIFlow Guide
绘制文本
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit
glass2_0 = unit.get(unit.GLASS2_OLED, unit.PORTA)
font_size = None
from numbers import Number
font_size = 0
glass2_0.fill(0x000000)
for count in range(4):
font_size = (font_size if isinstance(font_size, Number) else 0) + 1
if font_size == 1:
glass2_0.print('M5STACK', 0, 0, 1, 0xffffff)
elif font_size == 2:
glass2_0.print('M5STACK', 10, 0, 2, 0xffffff)
elif font_size == 3:
glass2_0.print('M5STACK', 25, 0, 3, 0xffffff)
elif font_size == 4:
glass2_0.print('M5STACK', 40, 0, 4, 0xffffff)
font_size = 0
glass2_0.show()
wait_ms(500)
glass2_0.fill(0x000000)
glass2_0.show()
glass2_0.init_device_address(0x3C)
glass2_0.contrast(0)
glass2_0.invert(1)
glass2_0.power_ctrl(0x00)
glass2_0.scroll(0, 0)
glass2_0.show()
glass2_0.fill(0xffffff)
glass2_0.fill_rect(0, 0, 0, 0, 0xffffff)
glass2_0.hline(0, 0, 0, 0xffffff)
glass2_0.image(0, 0, "/flash/img/m5stack.pbm")
glass2_0.line(0, 0, 0, 0, 0xffffff)
glass2_0.pixel(0, 0, 0xffffff)
glass2_0.rect(0, 0, 0, 0, 0xffffff)
glass2_0.print('M5Stack', 0, 0, 1, 0xffffff)
glass2_0.vline(0, 0, 0, 0xffffff)