Pico Scroll: PicoGraphics scrolling text example.

pull/711/head
Phil Howard 2023-03-16 17:34:52 +00:00
rodzic 1b0b783a2f
commit f9b46ba3a7
1 zmienionych plików z 24 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,24 @@
from picographics import PicoGraphics, DISPLAY_SCROLL_PACK, PEN_P8
from picoscroll import PicoScroll
import time
TEXT = "Hello World"
# By default P8 has a greyscale palette
graphics = PicoGraphics(DISPLAY_SCROLL_PACK, pen_type=PEN_P8)
scroll = PicoScroll()
t = scroll.get_width()
wrap = -graphics.measure_text(TEXT, scale=0)
while True:
graphics.set_pen(0)
graphics.clear()
graphics.set_pen(255)
graphics.text(TEXT, t, 0, scale=1)
scroll.update(graphics)
t -= 1
time.sleep(0.1)
if t <= wrap:
t = scroll.get_width()