Skip to content

Commit 0cd05c9

Browse files
authored
Merge pull request #42 from FoamyGuy/magtag_example
MagTag example
2 parents d3f5d12 + 80d5f98 commit 0cd05c9

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""
2+
Basic imageload example script
3+
adapted for use on MagTag.
4+
"""
5+
import time
6+
import board
7+
import displayio
8+
import adafruit_imageload
9+
10+
# use built in display (PyPortal, PyGamer, PyBadge, CLUE, etc.)
11+
# see guide for setting up external displays (TFT / OLED breakouts, RGB matrices, etc.)
12+
# https://learn.adafruit.com/circuitpython-display-support-using-displayio/display-and-display-bus
13+
display = board.DISPLAY
14+
15+
# wait until the display is ready
16+
time.sleep(display.time_to_refresh)
17+
18+
image, palette = adafruit_imageload.load("images/magtag_2x2_test.bmp")
19+
20+
tile_grid = displayio.TileGrid(image, pixel_shader=palette)
21+
22+
# scale 8 for full screen
23+
group = displayio.Group(scale=8)
24+
group.append(tile_grid)
25+
26+
# show the group and refresh
27+
display.show(group)
28+
display.refresh()
29+
30+
while True:
31+
pass

examples/images/magtag_2x2_test.bmp

1.68 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 Foamyguy
2+
#
3+
# SPDX-License-Identifier: Unlicense

0 commit comments

Comments
 (0)