Skip to content

Commit eec7b34

Browse files
committed
adding a label example
1 parent d74656c commit eec7b34

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
This example uses addfruit_display_text.label to display text using a custom font
3+
loaded by adafruit_bitmap_font
4+
"""
5+
6+
import board
7+
from adafruit_bitmap_font import bitmap_font
8+
from adafruit_display_text import label
9+
10+
display = board.DISPLAY
11+
12+
# Set text, font, and color
13+
text = "HELLO WORLD"
14+
font = bitmap_font.load_font("fonts/Arial-16.bdf")
15+
color = 0xFF00FF
16+
17+
# Create the tet label
18+
text_area = label.Label(font, text=text, color=color)
19+
20+
# Set the location
21+
text_area.x = 20
22+
text_area.y = 20
23+
24+
# Show it
25+
display.show(text_area)

0 commit comments

Comments
 (0)