Skip to content

Commit 488c3c3

Browse files
Add an example which uses the methods that use OnDiskBitmap
1 parent 40fe2be commit 488c3c3

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
1.27 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-FileCopyrightText: 2021 Tim C for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
4+
import board
5+
from adafruit_turtle import Color, turtle
6+
7+
turtle = turtle(board.DISPLAY)
8+
9+
# The purpose of this test is to check that the OnDiskBitmap usage is
10+
# working correctly: bgpic(), changeturtle() & stamp()
11+
12+
# Make sure that the following file is copied to the CircuitPython drive
13+
ICON = "/icons/Play_48x48_small.bmp"
14+
turtle.bgpic(ICON)
15+
turtle.changeturtle(ICON)
16+
17+
starsize = min(board.DISPLAY.width, board.DISPLAY.height) * 0.9 # 90% of screensize
18+
19+
print("Turtle time! Lets draw a star")
20+
21+
turtle.pencolor(Color.BLUE)
22+
turtle.setheading(90)
23+
24+
turtle.penup()
25+
turtle.goto(-starsize / 2, 0)
26+
turtle.pendown()
27+
28+
start = turtle.pos()
29+
while True:
30+
turtle.forward(starsize)
31+
turtle.stamp()
32+
turtle.left(170)
33+
if abs(turtle.pos() - start) < 1:
34+
break
35+
36+
while True:
37+
pass

0 commit comments

Comments
 (0)